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 Peter Sch�tt <ne...@pstt.de> on 2013/05/06 15:34:33 UTC

A Comma /aSpace in a Query argument

Hallo,

I want to use a comma as part of a query argument.

E.G.

q=myfield:aa,bb

and "aa,bb" is the value of the field.

Do I have to mask it?

And what is about a space in an argument

q=myfield:aa bb

and "aa bb" is the value of the field.

Thanks for any hint.

Ciao
  Peter Sch�tt


Re: A Comma /aSpace in a Query argument

Posted by "giovanni.bricconi@banzai.it" <gi...@banzai.it>.
Try escaping it with a \


Giovanni

Il 06/05/13 15:34, Peter Sch�tt ha scritto:
> Hallo,
>
> I want to use a comma as part of a query argument.
>
> E.G.
>
> q=myfield:aa,bb
>
> and "aa,bb" is the value of the field.
>
> Do I have to mask it?
>
> And what is about a space in an argument
>
> q=myfield:aa bb
>
> and "aa bb" is the value of the field.
>
> Thanks for any hint.
>
> Ciao
>    Peter Schütt
>


Re: A Comma /aSpace in a Query argument

Posted by Jack Krupansky <ja...@basetechnology.com>.
Oops, and I neglected to mention that you can escape a single character with 
a backslash, or you can enclose the entire term in double quotes:

q=myfield:aa,bb
q=myfield:"aa,bb"

q=myfield:aa\ bb
q=myfield:"aa bb"

-- Jack Krupansky

-----Original Message----- 
From: Jack Krupansky
Sent: Monday, May 06, 2013 9:51 AM
To: solr-user@lucene.apache.org
Subject: Re: A Comma /aSpace in a Query argument

Commas, dots, hyphens, slashes, and semicolons do not need to be "escaped",
but spaces do.

But... be careful, because some analyzers will throw away all or most
punctuation. You may have to resort to the white space analyzer to preserver
punctuation characters, but you can add char filters to eliminate
punctuation that you don't want to keep.

-- Jack Krupansky

-----Original Message----- 
From: Peter Schütt
Sent: Monday, May 06, 2013 9:34 AM
To: solr-user@lucene.apache.org
Subject: A Comma /aSpace in a Query argument

Hallo,

I want to use a comma as part of a query argument.

E.G.

q=myfield:aa,bb

and "aa,bb" is the value of the field.

Do I have to mask it?

And what is about a space in an argument

q=myfield:aa bb

and "aa bb" is the value of the field.

Thanks for any hint.

Ciao
  Peter Schütt 


Re: A Comma /aSpace in a Query argument

Posted by Jack Krupansky <ja...@basetechnology.com>.
Commas, dots, hyphens, slashes, and semicolons do not need to be "escaped", 
but spaces do.

But... be careful, because some analyzers will throw away all or most 
punctuation. You may have to resort to the white space analyzer to preserver 
punctuation characters, but you can add char filters to eliminate 
punctuation that you don't want to keep.

-- Jack Krupansky

-----Original Message----- 
From: Peter Schütt
Sent: Monday, May 06, 2013 9:34 AM
To: solr-user@lucene.apache.org
Subject: A Comma /aSpace in a Query argument

Hallo,

I want to use a comma as part of a query argument.

E.G.

q=myfield:aa,bb

and "aa,bb" is the value of the field.

Do I have to mask it?

And what is about a space in an argument

q=myfield:aa bb

and "aa bb" is the value of the field.

Thanks for any hint.

Ciao
  Peter Schütt