G
G
GregIv2019-02-01 08:55:28
Sphinx
GregIv, 2019-02-01 08:55:28

SPHINX: How to find all query words within n-words?

Good afternoon!
Just an example:
1) Request - "mom washed the frame"
2) Condition - the length of the found phrase should not exceed 7 words.
Need result:
'... mom washed the frame ..' //Length 3 words from the first desired word to the last.
'... mom and dad washed the window frame ... ' //5 words '
... mom and brother washed the window frame ...'// 6 Texts
with the following content should NOT be found : washes the frame ' // 8 words ' Mom was presented with a wonderful frame , but she did not

washes ' //9 words
How can this be done? Where to dig, in the direction of indexing settings, or a query?
PS
I am considering alternative search engines, as well as crutches. The search time is not critical. this is a background task.
PPS I
came up with a terrible crutch:
1) We get snippets with "highlighting" occurrences ( sauron.org.ua/post/1113).
2) We count the number of words from the first highlighted word to the last one.
3) Filtering

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2019-02-01
@GregIv

Proximity distance is specified in words, adjusted for word count, and applies to all words within quotes. For instance, "cat dog mouse"~5 query means that there must be less than 8-word span which contains all 3 words, ie. "CAT aaa bbb ccc DOG eee fff MOUSE" document will not match this query, because this span is exactly 8 words long.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question