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 "rrotstain@hotmail.com" <rr...@hotmail.com> on 2011/12/17 22:22:57 UTC

multi value field search

Hi guys,

I have a problem that I hope you guys can help with.  I have a multi-value
field that I use to store the alias names of companies. For example, in
Canada, the bank CIBC actually stands for Canadian Imperial Bank of
Commerce, so I'm storing both of these (short name and long name) in a
multi-value field.  At index time, I'd like to tokenize this field so that a
search for "bank" will return this record. I have this working using the
field type "text_ws". 

The problem I have is that at search time, I have faceting turned on for
this field and therefore, I get the four facets "canadian", "imperial",
"bank", and "commerce", which all refer to the same record.

How can I go about searching for any word contained in the company name but
then return the entire company name as one facet?

Thanks for your help.
--Ronen

--
View this message in context: http://lucene.472066.n3.nabble.com/multi-value-field-search-tp3594701p3594701.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: multi value field search

Posted by Lee Carroll <le...@googlemail.com>.
You could use a synonyms file for the alternative names. That way you
do not need to store only index the alternatives.
For faceting use a field were the analysis chain does not use the
synonyms filter. For search the analysis chain will.
You also get the benefit of only storing the normative values so
display is easy.





On 18 December 2011 02:16, Michael Ryan <mr...@moreover.com> wrote:
>> The problem I have is that at search time, I have faceting turned on for
>> this field and therefore, I get the four facets "canadian", "imperial",
>> "bank", and "commerce", which all refer to the same record.
>>
>> How can I go about searching for any word contained in the company name but
>> then return the entire company name as one facet?
>
> The typical way to do this is to have two fields with the same data - one for faceting and one for searching. The faceted field can just be a plain StrField.
>
> -Michael

RE: multi value field search

Posted by Ronen <rr...@hotmail.com>.
Many thanks.. I took the suggestion of using a <copyField/> and it did the
trick.

--Ronen

--
View this message in context: http://lucene.472066.n3.nabble.com/multi-value-field-search-tp3594701p3599082.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: multi value field search

Posted by Michael Ryan <mr...@moreover.com>.
> The problem I have is that at search time, I have faceting turned on for
> this field and therefore, I get the four facets "canadian", "imperial",
> "bank", and "commerce", which all refer to the same record.
> 
> How can I go about searching for any word contained in the company name but
> then return the entire company name as one facet?

The typical way to do this is to have two fields with the same data - one for faceting and one for searching. The faceted field can just be a plain StrField.

-Michael