2

I have a custom field to be Indexed for each Item. If it does not get the value it returns string.Empty. Before when Item's searched in Solr, whose custom fields are string.empty the field was not present in the item. But recently after Indexing for an item, the custom field with empty string is coming in the Solr. So suppose my custom field name is custom_fac_s. earlier when Solr is queried like: custom_fac_s: "", it did not return any item, but recently it does. Is there a change in Solr Behaviour? I am using Sitecore 9. The field is mapped in Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration.config as below:

<field fieldName="Custom_Fac" storageType="yes" returntype="string" indexType="untokenized">extensions.Search.AddCustomFacetIndexField,extensions</field>
2
  • 1
    Sitecore does not store empty strings and nulls in your index because they waste space. make sure you don't have nullValue="NULLVALUE" emptyString="EMPTYVALUE" parameters in config. Also try to run your query against the Solr directly. Jun 15 '20 at 10:11
  • If the code in your computed field returns null for some items, custom_fac_s will not be present for the items in Solr. However, returning string.Empty will have make the field present in the documents.
    – adarsh
    Jun 17 '20 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.