I think you'll need a SpanQuery with the inOrder flag set:
https://lucene.apache.org/core/8_8_1/core/org/apache/lucene/search/spans/SpanNearQuery.html

Charlie

On 17/03/2021 10:30, Vlad Smirnovskiy wrote:
Hello!

I`d like to do something like that: When I add a document and some text is
going with (e.g.) quotes it should mean that this text has to be exactly in
the query. Better with an examples -

text: green "blue apple" juice

query : blue apple - result: hit.
query : blue apple juice - result: hit.
query : apple blue - result: none.
query : blue - result: none.
query : blu appl - result: none.

So, the words with quotes have to go exactly in this order as they are in
doc

Can I do that with Lucene 8.* and how?


Best regards.


--
Charlie Hull - Managing Consultant at OpenSource Connections Limited <www.o19s.com> Founding member of The Search Network <https://thesearchnetwork.com/> and co-author of Searching the Enterprise <https://opensourceconnections.com/about-us/books-resources/>
tel/fax: +44 (0)8700 118334
mobile: +44 (0)7767 825828

Reply via email to