Re: Phrase Queries vs. SpanTermQueries exact phrases vs. stop words

2012-02-01 Thread Doron Cohen
> int gap = (pp[pp.length-1] - pp[0]) - (pp.length - 1); > > Don't want to cause an IndexOutOfBoundsException Right... that's what I meant with "(boundary cases)"...

RE: Phrase Queries vs. SpanTermQueries exact phrases vs. stop words

2012-02-01 Thread Paul Allan Hill
>Doron wrote: > > int gap = (pp[pp.length] - pp[0]) - (pp.length - 1); int gap = (pp[pp.length-1] - pp[0]) - (pp.length - 1); Don't want to cause an IndexOutOfBoundsException -Paul - To unsubscribe, e-mail: java-user-unsub

RE: Phrase Queries vs. SpanTermQueries exact phrases vs. stop words

2012-02-01 Thread Paul Allan Hill
Thanks for the discussion, I really appreciate you pointing out that the > Code here ignores PhraseQuery (PQ) 's positions: And by "here" you mean my original code not your suggestion. > To accommodate for this, the overall extra gap can be added to the slope: > int gap = (pp[pp.length] -

Re: Phrase Queries vs. SpanTermQueries exact phrases vs. stop words

2012-01-31 Thread Doron Cohen
Hi, Code here ignores PhraseQuery (PQ) 's positions: int[] pp = PQ.getPositions(); These positions have extra gaps when stop words are removed. To accommodate for this, the overall extra gap can be added to the slope: int gap = (pp[pp.length] - pp[0]) - (pp.length - 1); // (+/- bounda

Phrase Queries vs. SpanTermQueries exact phrases vs. stop words

2012-01-31 Thread Paul Allan Hill
In Lucene, 3.4 I recently implemented "Translating PhraseQuery to SpanNearQuery" (see Lucene in Action, page 220) because I wanted _order_ to matter. Here is my exact code called from getFieldsQuery once I know I'm looking at a PhraseQuery, but I think it is exactly from the book. static Q