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

yannis_p’s picture

Issue summary: View changes
drunken monkey’s picture

Are 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_file contains 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).

yannis_p’s picture

Hi drunken monkey and thanks for your response.

The tm_attachments_field_attached_file field 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:

{
	"response": {
		"numFound": 38,
		"start": 0,
		"maxScore": 0.21026656,
		"docs": [{
			"item_id": "706",
			"score": 0.21026656
		},
		{
			"item_id": "1183",
			"score": 0.15511598
		},
               ....
	"highlighting": {
		"rd25vi-search_api_solr_index-706": {
			"spell": ["[HIGHLIGHT]EFFECTIVENESS[/HIGHLIGHT]",
			"[HIGHLIGHT]EFFECTIVENESS[/HIGHLIGHT]",
			"[HIGHLIGHT]EFFECTIVENESS[/HIGHLIGHT]"]
		},
		"rd25vi-search_api_solr_index-1183": {
			"spell": ["[HIGHLIGHT]EFFECTIVENESS[/HIGHLIGHT]",
			"[HIGHLIGHT]EFFECTIVENESS[/HIGHLIGHT]",
			"[HIGHLIGHT]EFFECTIVENESS[/HIGHLIGHT]"]
		},
          }

Do you think this is normal?

drunken monkey’s picture

Project: Search API Pages » Search API Solr
Version: 7.x-1.1 » 7.x-1.x-dev
Component: Miscellaneous » Code

The tm_attachments_field_attached_file field is not tokenized in my configuration, the other fields are.

You mean you have the "Tokenizer" processor enabled? As said, you shouldn't do that when using Solr. Or is there a specific reason?

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).

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 fl parameter to fl=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).

yannis_p’s picture

That is normal, you'd have to enable "Retrieve results data from Solr" in the server settings to change that.

Thank 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?

drunken monkey’s picture

Category: Bug report » Support request
Status: Active » Fixed

OK, good to hear!

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?

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".

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.