You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Eric Caron <er...@gmail.com> on 2011/03/04 16:40:16 UTC

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?

Re: Excluding negative phrases

Posted by Eric Caron <er...@gmail.com>.
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 <ge...@sbcglobal.net> 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 <er...@gmail.com>
> To: solr-user@lucene.apache.org
> 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?
>

Re: Excluding negative phrases

Posted by Dennis Gearon <ge...@sbcglobal.net>.
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 <er...@gmail.com>
To: solr-user@lucene.apache.org
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?