Best way to integrate custom functionality

View: New views
2 Messages — Rating Filter:   Alert me  

Best way to integrate custom functionality

by Andrew Nguyen-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: Best way to integrate custom functionality

by Otis Gospodnetic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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@...>
> To: solr-user@...
> 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