Re: White space in facet values

2010-12-22 Thread Chris Hostetter

: Huh, does !term in 4.0 mean the same thing as !field in 1.4?  What you
: describe as !term in 4.0 dev is what I understand as !field in 1.4 doing.

There is a subtle distinction between {!field}, {!raw}, and {!term} which 
i attempted to explain on slides 26 and 43 in this presentation...

http://people.apache.org/~hossman/apachecon2010/facets/

(you can use the HTML controls or "print preview" to view the notes i had 
when giving it)

The nutshell explanation...

when building filter queries from facet constraint values:
* {!field} works in a lot of situations, but if you are using an analyzer 
on your facet field, there are some edge cases were it won't do what you 
expect.
* {!raw} is truely raw terms, which works in almost all cases where you 
are likely using facet.field -- but it's too raw for some field 
types that use binary term values (like Trie) 
* {!term} does exactly what you would expect/want in all cases when your 
input is a facet constraint.  it builts a term query from the human 
readable string representation (even if the internal representation is 
binary)

-Hoss


Re: White space in facet values

2010-12-22 Thread Jonathan Rochkind
Huh, does !term in 4.0 mean the same thing as !field in 1.4?  What you 
describe as !term in 4.0 dev is what I understand as !field in 1.4 doing.


On 12/22/2010 10:01 AM, Yonik Seeley wrote:

On Wed, Dec 22, 2010 at 9:53 AM, Dyer, James  wrote:

The phrase solution works as does escaping the space with a backslash:  
fq=Product:Electric\ Guitar ... actually a lot of characters need to be escaped 
like this (amperstands and parenthesis come to mind)...

One way to avoid escaping is to use the raw or term query parsers:

fq={!raw f=Product}Electric Guitar

In 4.0-dev, use {!term} since that will work with field types that
need to transform the external representation into the internal one
(like numeric fields need to do).

http://wiki.apache.org/solr/SolrQuerySyntax

-Yonik
http://www.lucidimagination.com





I assume you already have this indexed as "string", not "text"...

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-Original Message-
From: Andy [mailto:angelf...@yahoo.com]
Sent: Wednesday, December 22, 2010 1:11 AM
To: solr-user@lucene.apache.org
Subject: White space in facet values

How do I handle facet values that contain whitespace? Say I have a field "Product" that I want to facet on. A 
value for "Product" could be "Electric Guitar". How should I handle the white space in 
"Electric Guitar" during indexing? What about when I apply the constraint fq=Product:Electric Guitar?






Re: White space in facet values

2010-12-22 Thread Jonathan Rochkind
Another technique, which works great for facet fq's and avoids the need 
to worry about escaping, is using the "field" query parser instead:


fq={!field f=Product}Electric Guitar

Using the "field" query parser avoids the need for ANY escaping of your 
value at all, which is convenient in the facetting case -- you still 
need to URI-escape (ampersands for instance), but you shouldn't need to 
escape any Solr special characters like parens or double quotes or 
anything else, if you've made your string suitable for including in a 
URI. With the "field" query parser, a lot less to worry about.


http://lucene.apache.org/solr/api/org/apache/solr/search/FieldQParserPlugin.html

On 12/22/2010 9:53 AM, Dyer, James wrote:

The phrase solution works as does escaping the space with a backslash:  
fq=Product:Electric\ Guitar ... actually a lot of characters need to be escaped 
like this (amperstands and parenthesis come to mind)...

I assume you already have this indexed as "string", not "text"...

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-Original Message-
From: Andy [mailto:angelf...@yahoo.com]
Sent: Wednesday, December 22, 2010 1:11 AM
To: solr-user@lucene.apache.org
Subject: White space in facet values

How do I handle facet values that contain whitespace? Say I have a field "Product" that I want to facet on. A 
value for "Product" could be "Electric Guitar". How should I handle the white space in 
"Electric Guitar" during indexing? What about when I apply the constraint fq=Product:Electric Guitar?






Re: White space in facet values

2010-12-22 Thread Yonik Seeley
On Wed, Dec 22, 2010 at 9:53 AM, Dyer, James  wrote:
> The phrase solution works as does escaping the space with a backslash:  
> fq=Product:Electric\ Guitar ... actually a lot of characters need to be 
> escaped like this (amperstands and parenthesis come to mind)...

One way to avoid escaping is to use the raw or term query parsers:

fq={!raw f=Product}Electric Guitar

In 4.0-dev, use {!term} since that will work with field types that
need to transform the external representation into the internal one
(like numeric fields need to do).

http://wiki.apache.org/solr/SolrQuerySyntax

-Yonik
http://www.lucidimagination.com




> I assume you already have this indexed as "string", not "text"...
>
> James Dyer
> E-Commerce Systems
> Ingram Content Group
> (615) 213-4311
>
>
> -Original Message-
> From: Andy [mailto:angelf...@yahoo.com]
> Sent: Wednesday, December 22, 2010 1:11 AM
> To: solr-user@lucene.apache.org
> Subject: White space in facet values
>
> How do I handle facet values that contain whitespace? Say I have a field 
> "Product" that I want to facet on. A value for "Product" could be "Electric 
> Guitar". How should I handle the white space in "Electric Guitar" during 
> indexing? What about when I apply the constraint fq=Product:Electric Guitar?
>
>
>
>


RE: White space in facet values

2010-12-22 Thread Dyer, James
The phrase solution works as does escaping the space with a backslash:  
fq=Product:Electric\ Guitar ... actually a lot of characters need to be escaped 
like this (amperstands and parenthesis come to mind)...

I assume you already have this indexed as "string", not "text"...

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-Original Message-
From: Andy [mailto:angelf...@yahoo.com] 
Sent: Wednesday, December 22, 2010 1:11 AM
To: solr-user@lucene.apache.org
Subject: White space in facet values

How do I handle facet values that contain whitespace? Say I have a field 
"Product" that I want to facet on. A value for "Product" could be "Electric 
Guitar". How should I handle the white space in "Electric Guitar" during 
indexing? What about when I apply the constraint fq=Product:Electric Guitar?


  


Re: White space in facet values

2010-12-22 Thread Marco Martinez
try to copy the values (with copyfield) to a string field

Marco Martínez Bautista
http://www.paradigmatecnologico.com
Avenida de Europa, 26. Ática 5. 3ª Planta
28224 Pozuelo de Alarcón
Tel.: 91 352 59 42


2010/12/22 Peter Karich 

>
>
> you should try fq=Product:"Electric Guitar"
>
>
> > How do I handle facet values that contain whitespace? Say I have a field
> "Product" that I want to facet on. A value for "Product" could be "Electric
> Guitar". How should I handle the white space in "Electric Guitar" during
> indexing? What about when I apply the constraint fq=Product:Electric Guitar?
>
> --
> http://jetwick.com open twitter search
>
>


Re: White space in facet values

2010-12-22 Thread Peter Karich


you should try fq=Product:"Electric Guitar"


> How do I handle facet values that contain whitespace? Say I have a field 
> "Product" that I want to facet on. A value for "Product" could be "Electric 
> Guitar". How should I handle the white space in "Electric Guitar" during 
> indexing? What about when I apply the constraint fq=Product:Electric Guitar?

-- 
http://jetwick.com open twitter search



White space in facet values

2010-12-21 Thread Andy
How do I handle facet values that contain whitespace? Say I have a field 
"Product" that I want to facet on. A value for "Product" could be "Electric 
Guitar". How should I handle the white space in "Electric Guitar" during 
indexing? What about when I apply the constraint fq=Product:Electric Guitar?