When doing some analytics on our search index to see if we can reduce the number of fields, I came across a problem where fields set to hidden within our content type display still wind up being indexed by SOLR. This is only valid for fields treated as such in SOLR, like taxonomy and boolean checkboxes.
To reproduce:
* Download and install apachesolr 7.x-1.x
* On any content type, add a boolean field and save.
* Go into manage displays for that content type. Verify your new field above is marked as "<Hidden>" under format
* Go into any node of that type, set a value for the new hidden field and save
* Go into your Apache SOLR index settings and reindex the updated node
* Using the out-of-the-box SOLR admin UI, look at the node you just indexed; you will see the hidden field show up.
Attached is a patch that fixes this; a simple typo in a conditional:
$instances[$bundle][$field_name]['display']['search_index'] != 'hidden'
... search_index is an array so it will always evaluate to true.
Let me know if more detail is needed.
Comment | File | Size | Author |
---|---|---|---|
#5 | apachesolr-hidden_display_indexed-1977832-5.patch | 928 bytes | blazindrop |
#3 | apachesolr-hidden_display_indexed-1977832-3.patch | 927 bytes | blazindrop |
#1 | apachesolr-hidden_display_indexed-1977832-1.patch | 799 bytes | blazindrop |
Comments
Comment #1
blazindrop CreditAttribution: blazindrop commentedComment #2
Nick_vhif this is true, we should check if the ['type'] is not empty :)
Comment #3
blazindrop CreditAttribution: blazindrop commentedRolled another patch with Nick's suggestions aftering chatting in IRC. I did add some extra code to avoid having the line wrap. Works good locally.
Comment #5
blazindrop CreditAttribution: blazindrop commentedReattaching recreated patch.
Comment #6
blazindrop CreditAttribution: blazindrop commentedAny thoughts on my previous comments? I imagine this is a pretty big issue because of the potential sensitivity of information behind hidden fields, not to mention the performance and memory improvements by not indexing hidden fields.
Comment #7
pwolanin CreditAttribution: pwolanin commentedLooks good to me. Committed to 7.x. Need to check 6.x-3.x
Comment #7.0
pwolanin CreditAttribution: pwolanin commentedencode angle brackets