Indeed it is not possible to do something like this efficiently. The only way to do something like this that I know of would be to index shingles and then query them by prefix.
Le jeu. 5 avr. 2018 à 14:11, Adam Hornacek <adam.horna...@icloud.com> a écrit : > Hello, > > I’m having difficulty finding a solution to the following problem: > > I’m trying to implement suggestions for PhraseQuery. Let’s say we have a > PhraseQuery in the form "com.example". I would like to find all the terms > that are right after the `example` term. From the implementation of the > PhraseQuery I was able to gather that it checks term positions; therefore, > I thought that it could be possible to find the term by the document id and > the position. However, I was not able to get much further. > `TermsEnum#ord()` ( > https://lucene.apache.org/core/7_2_1/core/org/apache/lucene/index/TermsEnum.html#ord--) > looks promising but it looks like the ordinal number is specific and does > not correlate to the term positions. `tokenStream()` call does not seem > feasible since it requires iterating over the terms and might be slow. > > Thank you very much for any input or suggestion. > > Yours sincerely, > Adam Hornáček > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >