lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: Matching on a multi valued field
Date Tue, 29 Mar 2011 21:10:33 GMT
Two things need to be done. First, define positionIncrementGap
(see http://wiki.apache.org/solr/SchemaXml) for the field.

Then use phrase searches with the slop less than what you've
defined for positionIncrementGap.

Of course you'll have to have a positionIncrementGap larger than the
number of tokens in any single entry in your multiValued field, and you'll
have to re-index.

Best
Erick

On Tue, Mar 29, 2011 at 4:57 PM, Brian Lamb
<brian.lamb@journalexperts.com> wrote:
> Hi all,
>
> I have a field set up like this:
>
> <field name="common_names" multiValued="true" type="text" indexed="true"
> stored="true" required="false" />
>
> And I have some records:
>
> RECORD1
> <arr name="common_names">
>  <str>man's best friend</str>
>  <str>pooch</str>
> </arr>
>
> RECORD2
> <arr name="common_names">
>  <str>man's worst enemy</str>
>  <str>friend to no one</str>
> </arr>
>
> Now if I do a search such as:
> http://localhost:8983/solr/search/?q=*:*&fq={!q.op=AND df=common_names}man's
> friend
>
> Both records are returned. However, I only want RECORD1 returned. I
> understand why RECORD2 is returned but how can I structure my query so that
> only RECORD1 is returned?
>
> Thanks,
>
> Brian Lamb
>

Mime
View raw message