help improving relevance of snippets displayed by Omega
Olly Betts
olly at survex.com
Sat Sep 19 01:04:26 BST 2020
On Fri, Sep 18, 2020 at 04:51:44PM -0400, Michael Decerbo wrote:
> I guess that this is because the template shows a snippet generated from
> the returned document's "sample" field:
>
> <small>$snippet{$field{sample}}</small><br>
>
> and perhaps the text in that "sample" field is fairly short and generated
> when the document is indexed-- is that correct?
Yes. You can specify how many bytes to store with omindex's
--sample-size=SIZE option, with the default being 512. It'll actually
stop at the previous word boundary before the limit.
> If so, is there a way to generate a snippet that is more responsive to the
> query terms entered by the user than what the default query template
> provides? Even something as crude as passing stemmed substrings to my
> application so that it can do a simple linear search for them in each
> displayed document?
You could use $terms to get the query terms matching the current
hit and do that, though $snippet also supports phrase queries and
wildcards which would be hard to replicate from just the individual
terms.
Cheers,
Olly
More information about the Xapian-discuss
mailing list