lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: Best way to integrate custom functionality
Date Thu, 09 Jul 2009 02:50:20 GMT

How about, for example

+cars -"no cars" -"nothing cars"

 
In other words, the basic query is the original query, and then loop over all negative words
and append exclude phrase clauses like in the above example.
That will find documents that have the word cars in them, but any documents with "no cars"
phrase or "nothing cars" phrase will be excluded.

Just make sure your negative words are not stopwords.

Otis--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----
> From: Andrew Nguyen <andrew-lists-solr-user@na-consulting.net>
> To: solr-user@lucene.apache.org
> Sent: Wednesday, July 8, 2009 7:17:09 PM
> Subject: Best way to integrate custom functionality
> 
> Hello all,
> 
> I am working on a project that involves searching through free-text fields and 
> would like to add the ability to filter out negative expressions at a very 
> simple level.  For example, the field may contain the text, "person has no 
> cars."  If the user were to search for "cars," I would like to be able to 
> intercept the results and return only those without the word "no" in front of 
> the search term.  While is is a very simple example, it's pretty much my end 
> goal.
> 
> I've been reading up on the various hooks provided within Solr but wanted to get 
> some guidance on the best way to proceed.
> 
> Thanks!
> 
> --Andrew


Mime
View raw message