Thanks so much for this. Using an un-ordered query, the -1 slop indeed returns the correct results, matching tokens at the same position.
I tried the same query but ordered both after and before rebuilding the source with Paul's changes to NearSpansOrdered but the query was still failing, returning no results. C>T> On Mon, Nov 23, 2009 at 11:59 AM, Mark Miller <markrmil...@gmail.com> wrote: > Your trying -1 with ordered right? Try it with non ordered. > > Christopher Tignor wrote: > > A slop of -1 doesn't work either. I get no results returned. > > > > this would be a *really* helpful feature for me if someone might suggest > an > > implementation as I would really like to be able to do arbitrary span > > searches where tokens may be at the same position and also in other > > positions where the ordering of subsequent terms may be restricted as per > > the normal span API. > > > > thanks, > > > > C>T> > > > > On Sun, Nov 22, 2009 at 7:50 AM, Paul Elschot <paul.elsc...@xs4all.nl > >wrote: > > > > > >> Op zondag 22 november 2009 04:47:50 schreef Adriano Crestani: > >> > >>> Hi, > >>> > >>> I didn't test, but you might want to try SpanNearQuery and set slop to > >>> > >> zero. > >> > >>> Give it a try and let me know if it worked. > >>> > >> The slop is the number of positions "in between", so zero would still be > >> too > >> much to only match at the same position. > >> > >> SpanNearQuery may or may not work for a slop of -1, but one could try > >> that for both the ordered and unordered cases. > >> One way to do that is to start from the existing test cases. > >> > >> Regards, > >> Paul Elschot > >> > >> > >>> Regards, > >>> Adriano Crestani > >>> > >>> On Thu, Nov 19, 2009 at 7:28 PM, Christopher Tignor < > >>> > >> ctig...@thinkmap.com>wrote: > >> > >>>> Hello, > >>>> > >>>> I would like to search for all documents that contain both "plan" and > >>>> > >> "_v" > >> > >>>> (my part of speech token for verb) at the same position. > >>>> I have tokenized the documents accordingly so these tokens exists at > >>>> > >> the > >> > >>>> same location. > >>>> > >>>> I can achieve programaticaly using PhraseQueries by adding the Terms > >>>> explicitly at the same position but I need to be able to recover the > >>>> Payload > >>>> data for each > >>>> term found within the matched instance of my query. > >>>> > >>>> Unfortunately the PayloadSpanUtil doesn't seem to return the same > >>>> > >> results > >> > >>>> as > >>>> the PhraseQuery, possibly becuase it is converting it inoto Spans > first > >>>> which do not support searching for Terms at the same document > position? > >>>> > >>>> Any help appreciated. > >>>> > >>>> thanks, > >>>> > >>>> C>T> > >>>> > >>>> -- > >>>> TH!NKMAP > >>>> > >>>> Christopher Tignor | Senior Software Architect > >>>> 155 Spring Street NY, NY 10012 > >>>> p.212-285-8600 x385 f.212-285-8999 > >>>> > >>>> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > >> For additional commands, e-mail: java-user-h...@lucene.apache.org > >> > >> > >> > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > -- TH!NKMAP Christopher Tignor | Senior Software Architect 155 Spring Street NY, NY 10012 p.212-285-8600 x385 f.212-285-8999