Without documenting that it does so, PrefixCompletionQuery's ctor blindly wraps the supplied analyzer in a CompletionAnalyzer if it is not already an instance of CompletionAnalyzer.

https://github.com/apache/lucene/blob/485141dd34ea866ad9dc59843770969d1b0c8fa2/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/PrefixCompletionQuery.java#L63

This means if you give it a PerFieldAnalyzerWrapper instance that correctly sets the suggest field to a CompletionAnalyzer, you are now double wrapped in a CompletionAnalyzer and (in my testing) will fail to properly match some prefixes (such as those with a space).

An unfortunate bit of magic although I suppose it is too late to rip it out. Would be nice to document it at least?

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to