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 Barry Galaxy <ba...@gmail.com> on 2012/11/21 16:25:14 UTC

Re: Copying few field using copyField to non multiValued field

i would also like to copy a few fields to a single-valued field.
my reasoning for this is to then perform exact-match search on the
concatenated field.
e.g.

full_name = first_name + last+name

i would then like to search:

full_name:"john foo"

but copyField is making the full_name field look like this:
<arr name="full_name">
<str>john</str>
<str>foo</str>
</arr>

which is not working for the exact match...

ideas?



--
View this message in context: http://lucene.472066.n3.nabble.com/Copying-few-field-using-copyField-to-non-multiValued-field-tp3066979p4021605.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Copying few field using copyField to non multiValued field

Posted by Erick Erickson <er...@gmail.com>.
It Depends (tm). In this case on what you mean by "exact match".
In Solr land, that has a precise meaning of a single token. So in
your example it wouldn't match since you have two tokens that
happen to be next to each other, not a single token"billy corgan".

But if you mean that you want a match for searching these
separate different searches:
"billy corgan",
"billy"
"corgan"

then this will work just fine if you do a copyField (with the appropriate
positionIncrementGap) and search for "billy corgan" as a _phrase_,
that is, with quotes.

Best
Erick


On Mon, Nov 26, 2012 at 10:00 AM, Barry Galaxy <ba...@gmail.com>wrote:

> thanx erick!
> oh, there was a typo in my example... i meant:
>
> /*full_name = first_name + last_name */
>
> you are correct, i would like to use keywordtokenizer to get an exact hit
> on
> a query such as:
>
> full_name:"Billy Corgan"
>
> coming from a source document with:
> */<first_name>Billy</first_name>  &
> <last_name>Corgan</last_name>/*
>
> is this possible with 'copyField'? or should i rather index the document
> with that value initially set into the <full_name> field (requiring a
> change
> to my ruby code)?
>
> cheers,
> B
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Copying-few-field-using-copyField-to-non-multiValued-field-tp3066979p4022373.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Copying few field using copyField to non multiValued field

Posted by Barry Galaxy <ba...@gmail.com>.
thanx erick!
oh, there was a typo in my example... i meant:

/*full_name = first_name + last_name */

you are correct, i would like to use keywordtokenizer to get an exact hit on
a query such as:

full_name:"Billy Corgan"

coming from a source document with:
*/<first_name>Billy</first_name>  &  
<last_name>Corgan</last_name>/*

is this possible with 'copyField'? or should i rather index the document
with that value initially set into the <full_name> field (requiring a change
to my ruby code)?

cheers,
B




--
View this message in context: http://lucene.472066.n3.nabble.com/Copying-few-field-using-copyField-to-non-multiValued-field-tp3066979p4022373.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Copying few field using copyField to non multiValued field

Posted by Erick Erickson <er...@gmail.com>.
Barry:

This is just an artifact of the output. If you set positionIncremenGap to 1
(or maybe 0, but I think 1) then phrase searches will work just fine across
multiple entries. With the proper setting for positionIncrementGap, there
is really no difference between multiValued and non-multiValued fields. I
think it defaults to 100 or something like that.

If by "exact match" you mean using something like a KeywordTokenizer, then
it wouldn't work anyway I don't think.

Best
Erick


On Wed, Nov 21, 2012 at 10:25 AM, Barry Galaxy <ba...@gmail.com>wrote:

> i would also like to copy a few fields to a single-valued field.
> my reasoning for this is to then perform exact-match search on the
> concatenated field.
> e.g.
>
> full_name = first_name + last+name
>
> i would then like to search:
>
> full_name:"john foo"
>
> but copyField is making the full_name field look like this:
> <arr name="full_name">
> <str>john</str>
> <str>foo</str>
> </arr>
>
> which is not working for the exact match...
>
> ideas?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Copying-few-field-using-copyField-to-non-multiValued-field-tp3066979p4021605.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>