1

Let's say you have an item with a checkbox field "DisplayOnPage", and the standard values for the Items template has "DisplayOnPage" set to be checked by default (thus the standard value for this field is "1"). If you do a field query against an index containing your item, and look for items where "displayonpage" = "1", your item that is using the standard value (again, to set the value of the DisplayOnPage field to 1) will NOT return as a result. If, on your item, you uncheck the DisplayOnPage field, save the item, then recheck the DisplayOnPage field, save again and publish - your item will be returned by your FieldQuery.

I believe the cause to this is that standard value fields are not stored by items explicitly in the database, so the Sitecore Search doesn't make the connection that your item implicitly has the value you're searching for.

Is there a way around this?

4
  • i have tried to replicate this & i'm able to get the results ![Screen Shot](i.stack.imgur.com/elnDw.png) Jan 31, 2017 at 5:21
  • 1
    Did you add the field after the items were already created? The new field value is then only stored after saving your item again. Jan 31, 2017 at 8:27
  • I forgot to add an important thing, I'm not getting the values in a custom index I'm setting up (both lucene and solr don't get the standard value)
    – Eduardo
    Feb 1, 2017 at 3:59
  • Try one more thing create a item with standard value checked field "DisplayOnPage" and then rebuild the index, because recently I was facing same kind of issue, After creating all the items I did check value on standard value and that checkbox value was not working for items. Feb 2, 2017 at 13:15

2 Answers 2

4

I can confirm this is working as you describe. Standard values or base templates in general are not available in the search index.

You'll have to add your own computed field to enable this:

https://reasoncodeexample.com/2014/01/29/indexing-base-templates-sitecore-7-content-search/

0

Based on the implementation of the crawling process, this should work as expected. However, if you added the standard value after the item was indexed it won't. Have you tried re-indexing?

1
  • yes, I've tried indexing after the item was created and the value is missing, it only shows after I manually change it and index again
    – Eduardo
    Feb 3, 2017 at 0:08

Your Answer

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

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