Book Search in Apache Solr

I am very new to Solr and I appreciate it. My task is to search for words in the body of books and return them in a small context. Until now, I store books in a point-separated database (slicing books with line breaks), I do a full-text search and return a string.

In Solr, I would have to do the same, or I can add the whole book (in .txt format), and whenever a match is found, return something like a match plus 100 words before and 100 words after or something- then how is it? Thanks

0
source share
1 answer

Allotment will fulfill your bets. http://wiki.apache.org/solr/HighlightingParameters

The following are relevant options:

hl.snippets The maximum number of highlighted snippets to generate per field..... hl.fragsize The size, in characters, of the snippets (aka fragments) created by the highlighter..... The default value is "100". hl.mergeContiguous Collapse contiguous fragments into a single fragment.... 

For what you described, set for him 5 (or something that a person can allow) fragments from the text field with hl.fl ; the length of each fragment is 400 characters (my approximation is 100 words) around a word / phrase.

See also hl.regex.slop for creating snippets around phrases and hl.simple.pre/hl.simple.post for markup.

+3
source

Source: https://habr.com/ru/post/907755/


All Articles