Share » Forums » Extensions » eZ Find » Search for an exact term in a...

Search for an exact term in a filtered query (fq) request

Search for an exact term in a filtered query (fq) request

Thursday 01 April 2010 7:42:01 am - 2 replies

Author Message

Paul Borgermans

Thursday 01 April 2010 10:34:47 am

The problem you are facing is that you filter on an anlyzed field where the text is split into terms corresponding to a field type "text" in the Solr schema.xml definition.

You have two options:

1) upgrade to ezfind 2.2 which allows different types of fields to be used for filtering, specify a "string" type in the case of ezstring, then filtering will be exact string matches. See ezfind.ini for details (docs are in progress on ez.no/doc)

2) modify the schema.xml file and use the copyfield feature:

define a field name "attr_brand_s" of type string

 <field name="attr_brand_s" type="string" indexed="true" stored="false"/>

and also a coyfield construct

 <copyField source="attr_brand_t" dest="attr_brand_s"/>

After this schema change, you need to re-index your site to actually create those fields

Then modify your filterquery to use "attr_brand_s" instead and it should return only "Hudson" brands

hth

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Paul Borgermans

Thursday 01 April 2010 10:44:24 am

And as a side note, you can use the second approach to do other nifty tricks in schema.xml if you have dedicated needs for filtering and matching, see http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu