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 escher2k <es...@yahoo.com> on 2007/04/19 21:52:38 UTC

Filter question...

I have a bunch of fields that I am trying to filter on.

When I try to filter the data across the multiple fields, the result seems
to even retrieve fields where the data is not present.

For instance if the filter query contains this -
primary_state:New Delhi OR primary_country:New Delhi OR primary_city:New
Delhi OR secondary_state:New Delhi OR secondary_country:New Delhi

The result retrieved even contains records that have "Rochester, New York". 

Is there a way to only retrieve those records that contain both the words
"New" and "Delhi".

Thanks.
-- 
View this message in context: http://www.nabble.com/Filter-question...-tf3609407.html#a10085687
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Filter question...

Posted by escher2k <es...@yahoo.com>.
Thanks Mike. I just tested it on one field and looks like it works fine.


Mike Klaas wrote:
> 
> On 4/19/07, escher2k <es...@yahoo.com> wrote:
>>
>> Thanks Jennifer. But the issue with the quotes would be that it would
>> match
>> the string exactly and
>> not find it, if there were other words in between (e.g. New Capital
>> Delhi).
> 
> If you want to restrict a section of a query to a field, use brackets:
> 
> city:(.....)
> 
> thus:
> 
> city:(New Delhi) --> city contains 'new' or 'delhi', highest score to
> those containing both
> city:(+New +Delhi) --> city contains 'new' AND city contains 'delhi'
> city:"New Delhi"~1000 --> city contain 'new' with 1000 words of
> 'delhi', highest score to matches having the words nearby
> 
> -Mike
> 
> 

-- 
View this message in context: http://www.nabble.com/Filter-question...-tf3609407.html#a10088449
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Filter question...

Posted by Mike Klaas <mi...@gmail.com>.
On 4/19/07, escher2k <es...@yahoo.com> wrote:
>
> Thanks Jennifer. But the issue with the quotes would be that it would match
> the string exactly and
> not find it, if there were other words in between (e.g. New Capital Delhi).

If you want to restrict a section of a query to a field, use brackets:

city:(.....)

thus:

city:(New Delhi) --> city contains 'new' or 'delhi', highest score to
those containing both
city:(+New +Delhi) --> city contains 'new' AND city contains 'delhi'
city:"New Delhi"~1000 --> city contain 'new' with 1000 words of
'delhi', highest score to matches having the words nearby

-Mike

Re: Filter question...

Posted by escher2k <es...@yahoo.com>.
Thanks Chris. We are using dismax already :)


Chris Hostetter wrote:
> 
> 
> : not find it, if there were other words in between (e.g. New Capital
> Delhi).
> 
> then you should use field:"New Delhi"~3 or (+field:New +field:Delhi) what
> you have now is going to match any docs that have "New" in any of the
> fields you care about or Delhi in whatever you default search field is.
> 
> incidently, your use case seems like it *desperately* cries out for you to
> use the dismax handler...
> 
> qt=dismax&q=New+Delhi&qf=primary_state^2+primary_country^2+primary_city^3+secondary_state+secondary_country&pf=primary_state^2+primary_country^2+primary_city^3+secondary_state+secondary_country&ps=5&mm=100
> 
> http://wiki.apache.org/solr/DisMaxRequestHandler
> http://lucene.apache.org/solr/api/org/apache/solr/request/DisMaxRequestHandler.html
> 
> 
> 
> 
> 
> -Hoss
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Filter-question...-tf3609407.html#a10088438
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Filter question...

Posted by Chris Hostetter <ho...@fucit.org>.
: not find it, if there were other words in between (e.g. New Capital Delhi).

then you should use field:"New Delhi"~3 or (+field:New +field:Delhi) what
you have now is going to match any docs that have "New" in any of the
fields you care about or Delhi in whatever you default search field is.

incidently, your use case seems like it *desperately* cries out for you to
use the dismax handler...

qt=dismax&q=New+Delhi&qf=primary_state^2+primary_country^2+primary_city^3+secondary_state+secondary_country&pf=primary_state^2+primary_country^2+primary_city^3+secondary_state+secondary_country&ps=5&mm=100

http://wiki.apache.org/solr/DisMaxRequestHandler
http://lucene.apache.org/solr/api/org/apache/solr/request/DisMaxRequestHandler.html





-Hoss


Re: Filter question...

Posted by escher2k <es...@yahoo.com>.
Thanks Jennifer. But the issue with the quotes would be that it would match
the string exactly and
not find it, if there were other words in between (e.g. New Capital Delhi).


Jennifer Seaman wrote:
> 
> 
>>Is there a way to only retrieve those records that contain both the 
>>words "New" and "Delhi".
> 
> I'm just starting with this, put I found you need to do;
> primary_state:"New Delhi"
> 
> I never used the OR yet!
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Filter-question...-tf3609407.html#a10087870
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Filter question...

Posted by Jennifer Seaman <je...@digitalartwork.org>.
>Is there a way to only retrieve those records that contain both the 
>words "New" and "Delhi".

I'm just starting with this, put I found you need to do;
primary_state:"New Delhi"

I never used the OR yet!