lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikhail Khludnev <>
Subject Re: Needs advice on auto-keyword-correction mode custom query
Date Mon, 06 Jan 2020 20:04:34 GMT
I think you need to search A for single doc with early termination. And
then search for either A or B.
The closest conditional logic query is WAND, but it doesn't do what's asked
btw, IndexSearcher combines Indices, and Queries.

On Mon, Jan 6, 2020 at 7:33 AM 小鱼儿 <> wrote:

> Hi everybody,
> I want to implement an auto-keyword-correction mode custom query: suppose a
> scenario where user inputs a keyword query A, but due to typo or other
> reasons, A should be B, A is not a valid term in lucene's index which B is.
> (I'm not considering NLP in high-dimensional semantice space which is out
> of scope here)
> I could use 2 queries to do this, but it's too costly. What i need is a
> "early-termination" mode:
>  (1) keyword A will hit a non-empty DocIDSet so will not query B; Or
>  (2) keyword A's DocIDSet will be empty and B's will then match
> That is "A OR B" likewise in C/C++ language. But here i notice Lucene's
> BooleanQuery's SHOULD relationship is not the solving way. Perhaps i need
> to implement another custom query class?
> btw, How can Lucene's Query API become high-order composable? Lucene's
> "LeafContext" concept is really very confusing me...

Sincerely yours
Mikhail Khludnev

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message