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 Tomasz Kępski <to...@kepski.pl> on 2009/12/11 14:11:17 UTC

Using facets to narrow results with multiword field

Hi,

I'm trying to prepare "narrow you search" functionality using facets. I 
do have some products and would like to use a brand as a narrow filter.

I did prepare in schema 2 fileds:

    <fieldType name="brand_string" class="solr.TextField" 
sortMissingLast="true"
 omitNorms="true" positionIncrementGap="100">
     <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.TrimFilterFactory" />
      </analyzer>
    </fieldType>

    <fieldType name="lower_string" class="solr.TextField" 
sortMissingLast="true"
 omitNorms="true" positionIncrementGap="100">
     <analyzer>
     <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory" />
        <filter class="solr.TrimFilterFactory" />
      </analyzer>
    </fieldType>


   <field name="brand" type="brand_string" indexed="true" stored="true" 
default=
"none"/>
   <field name="lbrand" type="lower_string" indexed="true" 
stored="false" defaul
t="none"/>

 <copyField source="brand" dest="lbrand"/>

I'm using facet.field=lbrand and do get good results for eg: Geomax, 
GeoMax, GEOMAX  all of them falls into "geomax". But when I'm filtering 
I do get strange results:

brand:geomax  gives numFound="0"
lbrand:geomax  gives numFound="57" (GEOMAX, GeoMag, Geomag)

How should I redefine brand to let narrow work correctly?

Tomek

Re: Using facets to narrow results with multiword field

Posted by Chris Hostetter <ho...@fucit.org>.
: 
: I'm using facet.field=lbrand and do get good results for eg: Geomax, GeoMax,
: GEOMAX  all of them falls into "geomax". But when I'm filtering I do get
: strange results:
: 
: brand:geomax  gives numFound="0"
: lbrand:geomax  gives numFound="57" (GEOMAX, GeoMag, Geomag)
: 
: How should I redefine brand to let narrow work correctly?

I'm not sure i understand what it is that isn't working for you ... if you 
are faceting on "lbrand" then you should filter on "lbrand" as well ... 
your query for "brand:geomax" is probably failing because you don't 
actually have "geomax" as a value for any doc -- which is what you should 
expect, since you didn't use a LowercaseFilter.

correct?




-Hoss


Re: Using facets to narrow results with multiword field

Posted by Tomasz Kępski <to...@kepski.pl>.
Correction:

> I'm using facet.field=lbrand and do get good results for eg: Geomag, 
> GeoMag, GEOMAG  all of them falls into "geomag". But when I'm filtering 
> I do get strange results:
> 
> brand:geomag  gives numFound="0"
> lbrand:geomag  gives numFound="57" (GEOMAG, GeoMag, Geomag)
> 
> How should I redefine brand to let narrow work correctly?

Of course all of the words are the same (only case is different)

TK