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 "ZAROGKIKAS,GIORGOS" <g....@multirama.gr> on 2010/06/21 14:42:22 UTC

solr string field

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 "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
>