I am creating custom content types each of which has an attached file the content of which is extracted with Search API attachments.
It seems to me that when in the highlighting processor, I check the "Create Excerpt" option, then it cannot correctly display the search results excerpt, when I search for a keyword in an attachment. By the way the search results page is Themed as search results
If however the searched keyword is from another full-text indexed field, then the search results are correctly highlighted.
Another symptom: If "Create Excerpt" is unchecked, then the result is highlighted but it only highlights the found word and no search context e.g.
Action … ACTION … ACTION …
The corresponding attachment field in Solr is something like tm_attachments_field_attached_file
Yannis
Comments
Comment #1
yannis_p commentedComment #2
drunken monkeyAre you maybe using the "Tokenizer" processor?
If so, that should always be disabled when using Solr!
Otherwise, try to get the result set from Solr and look whether the
tm_attachments_field_attached_filecontains complete text for each value, or only individual words. If that is the case and it's not the "Tokenizer" processor, it might be some bug in the Attachments module (which I haven't really used and don't know much).Comment #3
yannis_p commentedHi drunken monkey and thanks for your response.
The
tm_attachments_field_attached_filefield is not tokenized in my configuration, the other fields are.Also when I submit the query, the returned json only returns a list of documents the facets and the highlighted terms (nothing from the indexed fields).
Here is a short excerpt:
Do you think this is normal?
Comment #4
drunken monkeyYou mean you have the "Tokenizer" processor enabled? As said, you shouldn't do that when using Solr. Or is there a specific reason?
That is normal, you'd have to enable "Retrieve results data from Solr" in the server settings to change that. Or, when manually executing the Solr query, change the
flparameter tofl=item_id,score,tm_attachments_field_attached_file.Also, moving to the correct project (for now – maybe the Attachments module is the cause after all).
Comment #5
yannis_p commentedThank you drunken_monkey this solved the problem! I hadn't checked this this option but to be honest the associated info is discouraging, because it says that this might make item loads unnecessary and produce incorrect search results due to caching ;)
I know this option should belong to "Server" settings but is there any way to warn users in the future releases, to check this option when they visit the Highlight processor?
Comment #6
drunken monkeyOK, good to hear!
Since this is a Solr-specific setting and the Highlight processor is in the Search API, this isn't really possible, no.
Also, highlighting will still work if you select "Always" for "Highlight returned field data".