I have approximately 300 book-sized documents (50k up to 300k words each) that I'm trying to make searchable. I would like to display as many excerpts from each result as possible up to a maximum number.
It appears that excerpts are handled by Solr's highlighters, but there doesn't appear to be any parameters I can change to force it to show me more. The closest I've found is this:
hl.snippets - Specifies maximum number of highlighted snippets to generate per field. It is possible for any number of snippets from zero to this value to be generated. The default is 1.
but it seems to have no effect on the results returned. I've increased this to 50, along with increasing maxAnalyzedChars and fragsize to no avail.
EDIT: If I add hl.snippets=50 in a manually composed query it performs as expected - for some reason search_api_solr isn't applying the setting, it always returns 2 snippets. I've also noticed that it's not respecting my search:excerpt view settings.
Will keep updating as I persist.
I've been at this for nearly a week now and am about to start looking at other solutions. Hopefully I'm just being dense - any help is appreciated!
A little more background: I am loading up a database with several hundred manuals, from small to phone-book sized. I need the user to be able to:
- search the entire database using keywords and facets. The results must feature many large snippets which can be skimmed to determine which document is the correct one for their purpose
- Then they need to perform a second search within that document only, which they will refine until they find exactly what the need from it.
So I need the ability to display lots of verbose snippets and any extra control I can have over how they are generated would be a huge boon.
Thank you :)
<str name="hl">on</str> <str name="hl.fl">fieldname</str> <str name="hl.snippets">20</str>
to solrconfig.xml and confirmed that it does cause solr to return the specified number of snippets, but I still can't figure out how to get search_api_solr do the same. It appears that no matter the settings I apply in the search index or search server, the module still insists on returning 3 or less snippets and generating them via search_api's highlight.php.
[Update] There is a setting in: Configuration -> Search API -> Search Server -> EDIT -> Advanced: "Retrieve result data from Solr" and "Retrieve highlighted snippets" that sounds like it makes drupal use solr's response instead of creating it via php but it appears to have no effect.
[Update] Ok, so now I guess I am going to attempt to create a simple module that uses hooks to modify the query and override the appropriate parameters, then hope that the results get processed properly.
[Update] Used devel and determined that Solr is returning the correct number of snippets according to my changed seettings in solrconfig.xml, so it's just a matter of getting drupal to take them and display them. I guess this means either hooking into highlight.php somewhere or just trying to hijack the query and write my own processor/template logic for it. Will share whatever solution I find. Tried to open an issue on drupal.org but it got flagged as spam. Oh bother :)
[Update] I am officially giving up. In order for drupal to work with the snippits that solr returns, "Retrieve result data from Solr" and "Retrieve highlighted snippets" must be enabled. When they are enabled however, Drupal asks Solr to send every field used for snippets for each result - in my case these fields are huge so this destroys performance. When those options are not enabled, Solr returns just the result data and highlights, but I cannot work with them because highlight.php generates it's own snippets from scratch. Oh well. My apologies to anyone who makes it here looking for a solution - and good luck!