You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Michael Wiegand <mi...@lsv.uni-saarland.de> on 2011/03/12 11:13:24 UTC
matching multi-word terms
Hi,
I would like to find documents matching multi-word terms, more
specifically: my query is something like "B C" and I would like match
contexts such as
"A B C D E"
but not
"B A C D E"
There seems to be some contradictory information on the web. Apparently,
the statement
Term t = new Term("f", "A B")
would not do the job. If this is so, what is the common procedure for
these type of terms? Some SpanQuery subclass?
Thank you in advance!
Best,
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: matching multi-word terms
Posted by Erick Erickson <er...@gmail.com>.
This looks like just a phrase query, perhaps with no slop.
Term query definitely won't work if you've tokenized a the field,
because your terms would be "A" and "B", but not "A B".
SpanQueries should also work if you want, there's no reason to
subclass anything, just use SpanNearQuery... You can
also specify whether Spans should allow out-of-order matches
or not.
Best
Erick
On Sat, Mar 12, 2011 at 5:13 AM, Michael Wiegand
<mi...@lsv.uni-saarland.de> wrote:
> Hi,
>
> I would like to find documents matching multi-word terms, more specifically:
> my query is something like "B C" and I would like match contexts such as
> "A B C D E"
> but not
> "B A C D E"
> There seems to be some contradictory information on the web. Apparently, the
> statement
> Term t = new Term("f", "A B")
> would not do the job. If this is so, what is the common procedure for these
> type of terms? Some SpanQuery subclass?
>
> Thank you in advance!
>
> Best,
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org