0

I'm working on a Solr problem. We're in the process of upgrading a Sitecore 9.2 version instance up to a 10.3. It's a multi-tenant site in Sitecore. Hosting ~10 sites. All the sites share a solr index called sitecore_content_index.

The index populates, and indexes. But when looking at the logs I see errors complaining about a type not being a multi-value field. Which in turn skip the item in question...

solr.log:

2024-03-11 03:33:14.585 ERROR (qtp945722724-1802) [   x:sitecore_content_index] o.a.s.h.RequestHandlerBase org.apache.solr.common.SolrException: ERROR: [doc=sitecore://web/{fbbc927c-2b87-4752-9f68-62b6ae3b503e}?lang=en&ver=4&ndx=sitecore_content_index] multiple values encountered for non multiValued field type_t: [f91310793df347dca682682e7f4c8019, be83aedac1164131aa63244e5b9c606b] => org.apache.solr.common.SolrException: ERROR: [doc=sitecore://web/{fbbc927c-2b87-4752-9f68-62b6ae3b503e}?lang=en&ver=4&ndx=sitecore_content_index] multiple values encountered for non multiValued field type_t: [f91310793df347dca682682e7f4c8019, be83aedac1164131aa63244e5b9c606b]
    at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:160)
org.apache.solr.common.SolrException: ERROR: [doc=sitecore://web/{fbbc927c-2b87-4752-9f68-62b6ae3b503e}?lang=en&ver=4&ndx=sitecore_content_index] multiple values encountered for non multiValued field type_t: [f91310793df347dca682682e7f4c8019, be83aedac1164131aa63244e5b9c606b]
    at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:160) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.AddUpdateCommand.makeLuceneDocs(AddUpdateCommand.java:243) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.DirectUpdateHandler2.updateDocOrDocValues(DirectUpdateHandler2.java:962) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.DirectUpdateHandler2.doNormalUpdate(DirectUpdateHandler2.java:342) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:294) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:241) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.processor.RunUpdateProcessorFactory$RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:73) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:263) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.processor.DistributedUpdateProcessor.doVersionAdd(DistributedUpdateProcessor.java:502) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.processor.DistributedUpdateProcessor.lambda$versionAdd$0(DistributedUpdateProcessor.java:343) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.VersionBucket.runWithLock(VersionBucket.java:50) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:343) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:229) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.update.processor.LogUpdateProcessorFactory$LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:106) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.handler.loader.XMLLoader.processUpdate(XMLLoader.java:263) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.handler.loader.XMLLoader.load(XMLLoader.java:190) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:97) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:82) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:216) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:2637) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:791) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:564) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:427) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:357) ~[solr-core-8.11.2.jar:8.11.2 17dee71932c683e345508113523e764c3e4c80fa - mdrob - 2022-06-13 11:27:54]
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600) ~[jetty-security-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:191) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.InetAccessHandler.handle(InetAccessHandler.java:177) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322) ~[jetty-rewrite-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:763) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:400) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:645) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:392) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:555) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:410) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:164) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]

The problem is, when I look at the Sitecore template of this item in question. The field is a multilist field, and in theory should be marked as a multi-value field in solr when indexing. I don't understand why this might be happening?!

So I've been looking at creating a custom computed field, that'll take this original Type, and return it back as a IEnumable<string> under a different field name called type_cp_sm. This worked, and I do see the new field getting created and populated.
Then, I was looking at excluding the original type field to prevent the solr error. I've not yet worked out how I can do this exclude. But the idea was if I exclude the bad field, no error will be thrown, and the Sitecore Items that contain multiple types will be indexed as expected. (currently they're getting skipped due to the error...). So, in essence circumventing the problem... I'm taking this approach, because I don't know how I can override Sitecore's schema to force the type to be a multi-value solr field...

So my questions are:

  1. Is this the best approach I'm taking? If so, how do I exclude the original field from the solr schema from sitecore's end?
  2. Is there a way to prevent this error via another approach?
  3. Why would the type field not be a multi-value field in solr if it's a multilist field in Sitecore?

I have looked at this documentation as well search and index configuration But I didn't quite understand where to put things.

/App_Config/Include/zzz/Custom_Index.config

solr config file

Proof the type is a multilist. As seen here in the debug window. debug window

Thanks in advance

2 Answers 2

1

Type field in Sitecore is a reserved field. This is used for field name resolution as mentioned below, which is a text field that cant contain multiple values.

https://doc.sitecore.com/xp/en/developers/90/platform-administration-and-architecture/using-solr-field-name-resolution.html

Field type in Solr is resolved by running below SOLR query which returns type_t.

https://{{solr_url}}/solr/{{solr_index}}/select?fq=_templatename:(Template field)&q=_name:({{field_name}})

This will return the type of that field as below:

enter image description here

You can find the default configuration for type field inside the fieldNames section as below which is of type text.

<fieldNames hint="raw:AddFieldByFieldName">
   <field fieldName="type" returnType="text" />
</fieldNames>

Will suggest you to either the change the field name to some other name in order to resolve this issue.

5
  • Hi there, due to this response I think it'll be wise for me to migrate the problem field to a new field called 'OfficeType' using PS. Then delete the problem custom type field from the custom OfficeLocation Template. Then reindex... Which I done already. But after doing this, I don't see the solr index indexing the new field. I created the new field, copied it over, deleted the old custom type field, then populated scheme, reindexed. Queried solr, and I don't see the field called OfficeType_sm. field on any item, but I do see it in the schema. What step have I missed here, do you know?
    – Anthony
    Mar 12 at 23:07
  • Actually manage to get a little bit further. I was able to see the new office type field in the solar index. But now I see that the field itself is only taking the first GUID and ignoring all GUIDs following. I've confirmed that the new type is a multilist and a multi value in solr fields. When I look in Sitecore itself, I do see multiple GUIDs in the raw value with a pipe delimiter as expected. So I'm unsure why solar would only be taking the first GUID.
    – Anthony
    Mar 13 at 2:27
  • Can you try rebuild the index from Control Panel once..
    – ckhanna
    Mar 13 at 7:44
  • Also check whether the other guids in the multilist field are there on the web database.
    – ckhanna
    Mar 13 at 7:53
  • Yes, the type being there was an issue. I in the end created a new officetype, copied it over. Then empty thy type_t field and repopulated the schema and reindexed. When I just deleted the type, Sitecore didn't clear out the data associated with the field, and that was still getting indexed like a ghost field. So the same error was blocking even though the type field was deleted. So by first saving the field as an empty string, then deleting it I managed to correct the issue. Thanks for the help
    – Anthony
    Mar 13 at 22:17
1

This error is coming because you are trying to save multi-value into string type. I would suggest you create a computed field for multi-list and then save the value in that custom field.

You need to use the field type as a stringCollection instead of string.

You can check this link https://www.nehemiahj.com/2021/07/sitecore-solr-multiple-values.html

4
  • Thanks for the reply. This would probably be the answer if I hadn't see channa's response below. Since it's a reserved field name. I think it wise to remove the problem field from my custom Sitecore template. Leaving the reserved name for Sitecore to manage. I attempted the computed field originally, and it only worked when the error was not triggered. So I'm thinking I'll create a new mulitlist field, and copy over the value from the problem field. Then delete the type field from my custom. :/ Rough plan anyway...
    – Anthony
    Mar 12 at 23:01
  • Maybe check out the response I gave to channa below around this. You might see my mistake..
    – Anthony
    Mar 12 at 23:08
  • @Anthony will you be able to paste your computed field code? Mar 14 at 2:44
  • Sorry I deleted it all, because I didn't go down that solution. But all it did was take the type field and parse it into a IEnumable<GUID> then returned that. It worked fine. But in the end I had to completely remove the source field. (The 'problem' field called type.) So just made more sense to copy the data to a new field, with a different name. Removing the need for a computed field completely.
    – Anthony
    Mar 18 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.