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 bluestar <se...@butterflycluster.net> on 2010/06/04 08:39:14 UTC

exclude docs with null field

hi there,

say my search query is "new york", and i am searching field1 and field2
for it, how do i specify that i want to exlude docs where field3 doesnt
exist?

thanks


Re: exclude docs with null field

Posted by Geert-Jan Brits <gb...@gmail.com>.
Additionally, I should have mentioned that you can instead do:
fq=field_3:[* TO *], which uses the filtercache.

The method presented by Chris will probably outperform the above method but
only on the first request, from then on the filtercache takes over.
>From a performance standpoint it's probably not worth going the 'default
value for null-approach' imho.
It IS useful however if you want to be able to query on docs with a
null-value (instead of excluding them)


2010/6/4 bluestar <se...@butterflycluster.net>

> nice one! thanks.
>
> >
> >> i could be wrong but it seems this
> >> way has a performance hit?
> >>
> >> or i am missing something?
> >
> > Did you read Chris's message in http://search-lucene.com/m/1o5mEk8DjX1/
> > He proposes alternative (more efficient) way other than [* TO *]
> >
> >
> >
> >
>
>
>

RE: solr string field

Posted by "ZAROGKIKAS,GIORGOS" <g....@multirama.gr>.
It's ok 
It was a problem with my schema

Thanks anyway

-----Original Message-----
From: Erik Hatcher [mailto:erik.hatcher@gmail.com] 
Sent: Monday, June 21, 2010 5:09 PM
To: solr-user@lucene.apache.org
Subject: Re: solr string field

Or even better for an exact string query:

    q={!raw f=field_name}sony vaio

(that's NOT URL encoded, but needs to be when sending the request over  
HTTP)

	Erik


On Jun 21, 2010, at 9:43 AM, Jan Høydahl / Cominvent wrote:

> Hi,
>
> You either need to quote your string: http://localhost:8983/solr/select?q= 
> "sony+vaio"
> or to escape the space: http://localhost:8983/solr/select?q=sony\+vaio
>
> If you do not do one of these, your query will be parsed as  
> text:sony OR text:vaio, which will not match your string field.
>
> --
> Jan Høydahl, search solution architect
> Cominvent AS - www.cominvent.com
> Training in Europe - www.solrtraining.com
>
> On 21. juni 2010, at 14.42, ZAROGKIKAS,GIORGOS wrote:
>
>> Hi
>> 	I use a string Field in my solr schema
>> 	but when I query a value with space it doesn't give me results
>> 	
>> 	e.g I have a value "sony vaio" when I query with "sony vaio" I
>> get 0 results
>> 	but when I query "sony*" I get my results
>>
>> 	how can I query a string field with a space between the values
>> 	or how can I have exact search in a string
>>
>>
>> Thanks in advance
>>
>


Re: solr string field

Posted by Erik Hatcher <er...@gmail.com>.
Or even better for an exact string query:

    q={!raw f=field_name}sony vaio

(that's NOT URL encoded, but needs to be when sending the request over  
HTTP)

	Erik


On Jun 21, 2010, at 9:43 AM, Jan Høydahl / Cominvent wrote:

> Hi,
>
> You either need to quote your string: http://localhost:8983/solr/select?q= 
> "sony+vaio"
> or to escape the space: http://localhost:8983/solr/select?q=sony\+vaio
>
> If you do not do one of these, your query will be parsed as  
> text:sony OR text:vaio, which will not match your string field.
>
> --
> Jan Høydahl, search solution architect
> Cominvent AS - www.cominvent.com
> Training in Europe - www.solrtraining.com
>
> On 21. juni 2010, at 14.42, ZAROGKIKAS,GIORGOS wrote:
>
>> Hi
>> 	I use a string Field in my solr schema
>> 	but when I query a value with space it doesn't give me results
>> 	
>> 	e.g I have a value "sony vaio" when I query with "sony vaio" I
>> get 0 results
>> 	but when I query "sony*" I get my results
>>
>> 	how can I query a string field with a space between the values
>> 	or how can I have exact search in a string
>>
>>
>> Thanks in advance
>>
>


Re: solr string field

Posted by Jan Høydahl / Cominvent <ja...@cominvent.com>.
Hi,

You either need to quote your string: http://localhost:8983/solr/select?q="sony+vaio"
or to escape the space: http://localhost:8983/solr/select?q=sony\+vaio

If you do not do one of these, your query will be parsed as text:sony OR text:vaio, which will not match your string field.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Training in Europe - www.solrtraining.com

On 21. juni 2010, at 14.42, ZAROGKIKAS,GIORGOS wrote:

> Hi 
> 	I use a string Field in my solr schema 
> 	but when I query a value with space it doesn't give me results
> 	
> 	e.g I have a value "sony vaio" when I query with "sony vaio" I
> get 0 results
> 	but when I query "sony*" I get my results
> 
> 	how can I query a string field with a space between the values 
> 	or how can I have exact search in a string 
> 
> 
> Thanks in advance
> 


solr string field

Posted by "ZAROGKIKAS,GIORGOS" <g....@multirama.gr>.
Hi 
	I use a string Field in my solr schema 
	but when I query a value with space it doesn't give me results
	
	e.g I have a value "sony vaio" when I query with "sony vaio" I
get 0 results
	but when I query "sony*" I get my results

	how can I query a string field with a space between the values 
	or how can I have exact search in a string 


Thanks in advance


Re: exclude docs with null field

Posted by bluestar <se...@butterflycluster.net>.
nice one! thanks.

>
>> i could be wrong but it seems this
>> way has a performance hit?
>>
>> or i am missing something?
>
> Did you read Chris's message in http://search-lucene.com/m/1o5mEk8DjX1/
> He proposes alternative (more efficient) way other than [* TO *]
>
>
>
>



Re: exclude docs with null field

Posted by Ahmet Arslan <io...@yahoo.com>.
> i could be wrong but it seems this
> way has a performance hit?
> 
> or i am missing something?

Did you read Chris's message in http://search-lucene.com/m/1o5mEk8DjX1/
He proposes alternative (more efficient) way other than [* TO *]


      

Re: exclude docs with null field

Posted by bluestar <se...@butterflycluster.net>.
i could be wrong but it seems this way has a performance hit?

or i am missing something?

> field1:"new york"+field2:"new york"+field3:[* TO *]
>
> 2010/6/4 bluestar <se...@butterflycluster.net>
>
>> hi there,
>>
>> say my search query is "new york", and i am searching field1 and field2
>> for it, how do i specify that i want to exlude docs where field3 doesnt
>> exist?
>>
>> thanks
>>
>>
>



Re: exclude docs with null field

Posted by Geert-Jan Brits <gb...@gmail.com>.
field1:"new york"+field2:"new york"+field3:[* TO *]

2010/6/4 bluestar <se...@butterflycluster.net>

> hi there,
>
> say my search query is "new york", and i am searching field1 and field2
> for it, how do i specify that i want to exlude docs where field3 doesnt
> exist?
>
> thanks
>
>

Re: exclude docs with null field

Posted by Ahmet Arslan <io...@yahoo.com>.
> say my search query is "new york", and i am searching
> field1 and field2
> for it, how do i specify that i want to exlude docs where
> field3 doesnt
> exist?


http://search-lucene.com/m/1o5mEk8DjX1/