Excluding negative phrases

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Excluding negative phrases

Eric Caron
*I searched for articles addressing this, but I can't think of a better way
to phrase the issue (a.k.a. sorry if I'm overlooking a Google-able answer).*

Is there a way in Solr to exclude matches that are preceded by a negative
word (e.g. If I'm running a dating site, and a user searches for "tall
woman", it'd be ideal be able to exclude phrases like "not a tall woman" or
"no tall woman".) How would one go about implementing this logic into a Solr
search?
Reply | Threaded
Open this post in threaded view
|

Re: Excluding negative phrases

gearond
One of the query processors works almost exactly like google, et al.

Just put a '-' in front of the term 'not to be in the result'

For example, try to find something WITH anniston but not with 'jennifer
anniston'?

put 'aniston -jennifer -jen' (she gets nicknamed 'jen').

 Dennis Gearon


Signature Warning
----------------
It is always a good idea to learn from your own mistakes. It is usually a better
idea to learn from others’ mistakes, so you do not have to make them yourself.
from 'http://blogs.techrepublic.com.com/security/?p=4501&tag=nl.e036'


EARTH has a Right To Life,
otherwise we all die.




________________________________
From: Eric Caron <[hidden email]>
To: [hidden email]
Sent: Fri, March 4, 2011 7:40:16 AM
Subject: Excluding negative phrases

*I searched for articles addressing this, but I can't think of a better way
to phrase the issue (a.k.a. sorry if I'm overlooking a Google-able answer).*

Is there a way in Solr to exclude matches that are preceded by a negative
word (e.g. If I'm running a dating site, and a user searches for "tall
woman", it'd be ideal be able to exclude phrases like "not a tall woman" or
"no tall woman".) How would one go about implementing this logic into a Solr
search?
Reply | Threaded
Open this post in threaded view
|

Re: Excluding negative phrases

Eric Caron
Yes, that solution does work when the end-user knows to do it. My question
was more towards the analyzer/tokenizer side of the equation, ideally with a
solution that'd lower the score if there's a hit preceded by a negating
word/phrase.

On Fri, Mar 4, 2011 at 2:26 PM, Dennis Gearon <[hidden email]> wrote:

> One of the query processors works almost exactly like google, et al.
>
> Just put a '-' in front of the term 'not to be in the result'
>
> For example, try to find something WITH anniston but not with 'jennifer
> anniston'?
>
> put 'aniston -jennifer -jen' (she gets nicknamed 'jen').
>
>  Dennis Gearon
>
>
> Signature Warning
> ----------------
> It is always a good idea to learn from your own mistakes. It is usually a
> better
> idea to learn from others’ mistakes, so you do not have to make them
> yourself.
> from 'http://blogs.techrepublic.com.com/security/?p=4501&tag=nl.e036'
>
>
> EARTH has a Right To Life,
> otherwise we all die.
>
>
>
>
> ________________________________
> From: Eric Caron <[hidden email]>
> To: [hidden email]
> Sent: Fri, March 4, 2011 7:40:16 AM
> Subject: Excluding negative phrases
>
> *I searched for articles addressing this, but I can't think of a better way
> to phrase the issue (a.k.a. sorry if I'm overlooking a Google-able
> answer).*
>
> Is there a way in Solr to exclude matches that are preceded by a negative
> word (e.g. If I'm running a dating site, and a user searches for "tall
> woman", it'd be ideal be able to exclude phrases like "not a tall woman" or
> "no tall woman".) How would one go about implementing this logic into a
> Solr
> search?
>