Hi all, hi Alan, I am currently rewriting some SpanQuery code to use IntervalQuery. Most of the transformations can be done quite easily and it is also better to read after transformation. What I am missing a bit is some document to compare the different query types and a guide how to convert those.
I did not find a replacement for SpanFirstQuery (or at least any query stat takes absolute positions). I know intervals more deal with term intervals, but I was successful in replacing a SpanFirstQuery with this: IntervalsSource term = Intervals.term("foo"); IntervalsSource filtered = new FilteredIntervalsSource("FIRST"+distance, term) { @Override protected boolean accept(IntervalIterator it) { return it.end() < distance; // or should this be <= distance??? } }; Query = new IntervalQuery(field, iv2); I am not fully sure if this works under all circumstances 😊. To me it looks fine and also did work with more complex intervals than "term". If this is ok, how about adding a "first(int n, IntervalsSource iv)" method to Intervals class? The second question: What's the "closest" replacement for a PhraseQuery with slop? Should I use maxwidth(slop + 1) or maxgaps(slop-1) or maxgaps(slop). I know SpanQuery slops cannot be fully replaced with intervals, but I don't care about those SpanQuery bugs. Uwe ----- Uwe Schindler Achterdiek 19, D-28357 Bremen https://www.thetaphi.de eMail: u...@thetaphi.de --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org