Please consider the related issue: #1977832

If a field is set as "Hidden" in the search_index display it would be ignored (and thus omitted) from SOLR index, this is OK for reducing the number of indexed fields; it is not correct if the omitted field is used for querying (or filtering) purposes and need to be indexed anyway not regarding its display setting in the search_index display.

Furthermore the "search_index" display is used to obtain the "content" SOLR Document field, thus if a field value is only needed for filtering the results (and it must not be added for full-text search) it will be indexed anyway.

The main idea behind the following patch is to index fields that are hidden in the search_index display but shown in the "search_result" display (the "search_result" display setting of a field is actually ignored at index time).

How to reproduce this issue:

  • Create a content type Document
  • Add a field named "myField" as a (integer) key|value pair with the list Module as "1|Drupal Rocks 2|Drupal Sks
  • Set the field as "Hidden" in the search_index node display
  • Build a searchpage, for the "custom filters" add "-im_field_myfield:2" (the aim is creating a search page excluding the "Drupal Sks" labeled nodes)
  • Add few contents
  • Try to search using hte previously creted page

No results will be found since the "field_myfield" won't never be indexed given that it is for the search_index display type

CommentFileSizeAuthor
#1 apachesolr-2182779-1.patch1.1 KBthePanz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

thePanz’s picture

Status: Active » Needs review
FileSize
1.1 KB