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 martinoleary <ma...@gmail.com> on 2008/07/15 10:53:58 UTC
MoreLikeThis from a field with a specific value
Hi there...
im trying to get MoreLikeThis documents from my lucene index given a
sentence... just one line of text lets say... but i also want to get the
returned results only where a field has a specific value....
so for example if i have my index and it contains a categoryId and
content... i would like to get results where content is like blah blah blah
and categoryId = 1 or 2.. etc...
my more like this like method is returning something like this:
content:blah content:blah content:blah +categoryId:2
but when this is run, its returning EVERYTHING from this category....
when i leave out the +categoryId: , i am getting related results depending
on the content.
can anyone help inform me as to why its returning everything?
--
View this message in context: http://www.nabble.com/MoreLikeThis-from-a-field-with-a-specific-value-tp18460696p18460696.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: MoreLikeThis from a field with a specific value
Posted by Daniel Noll <da...@nuix.com>.
martinoleary wrote:
> Hi there...
>
> im trying to get MoreLikeThis documents from my lucene index given a
> sentence... just one line of text lets say... but i also want to get the
> returned results only where a field has a specific value....
>
> so for example if i have my index and it contains a categoryId and
> content... i would like to get results where content is like blah blah blah
> and categoryId = 1 or 2.. etc...
>
> my more like this like method is returning something like this:
> content:blah content:blah content:blah +categoryId:2
>
> but when this is run, its returning EVERYTHING from this category....
Not surprising at all. This is what you actually want:
+(content:blah content:blah content:blah) +categoryId:2
Your original query's only REQUIRED constraint was that it match the
category.
Daniel
--
Daniel Noll
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org