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 Scatman <al...@sfr.com> on 2012/11/27 13:23:21 UTC

Solr : query for multiValued Field

I got a little problem with a query on multiValued field. I explain :

i got about 2000 documents so i will not show them all :) but an interest
point...

when i make this query : "q:Ford" i got 8 answers with 4 that Ford is in the
actor field (who is an multiValued field)
I try to make "q=actor:Ford" (even with fq) in order to get this 4 documents
but i got 0 matching
i had searched some answer but i only find the tip who is to change the gap
value ( more than 100)... but doesnt work for me... 
Here the field in schema.xml : 

                 <field name="actor" type="string" indexed="true"
stored="true" multiValued="true"/>

Here the format in the document : 

		<field name="actor">Paul Bettany</field>
		<field name="actor">Harrison Ford</field>
		<field name="actor">Virginia Madsen</field>
		<field name="actor">Robert Patrick</field>

Thanks for your help in advance :)



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-query-for-multiValued-Field-tp4022600.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr : query for multiValued Field

Posted by Scatman <al...@sfr.com>.
I will get it quickly :) 
thanks for advice ! 

Thread can be closed ^^ 



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-query-for-multiValued-Field-tp4022600p4022633.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr : query for multiValued Field

Posted by Erick Erickson <er...@gmail.com>.
String type is the only unanalyzed one that comes to mind. But.....
Anything that starts out with KeywordTokenizer will not be broken
up into tokens although the single token will go through filters, so
you could lowercase it.

The very best advice I can give is to have two tricks in your arsenal:

1> your new trick of &debugQuery=on (note that this is changing to
debug=all|query|results|true,
see: http://wiki.apache.org/solr/CommonQueryParameters#debug)

2> the admin>>analysis page.

In both cases, it's an _extremely_ good investment to spend some time
getting familiar with insights they provide.

Best
Erick


On Tue, Nov 27, 2012 at 8:23 AM, Scatman <al...@sfr.com> wrote:

> How to say it .... thanks a lot :D
>
> I just try it and it works ;)
> Indeed, i got a field "text" (the default field) which is a copy of all the
> field... i didnt think that debug query could help :$ but now it's in my
> mind !
> I didn't know that the string type was not analyse... Is the only one ? i
> will search it anyway :)
>
> Thanks a lot again !
> Good day to you ^^
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-query-for-multiValued-Field-tp4022600p4022628.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr : query for multiValued Field

Posted by Scatman <al...@sfr.com>.
How to say it .... thanks a lot :D 

I just try it and it works ;)
Indeed, i got a field "text" (the default field) which is a copy of all the
field... i didnt think that debug query could help :$ but now it's in my
mind ! 
I didn't know that the string type was not analyse... Is the only one ? i
will search it anyway :)

Thanks a lot again ! 
Good day to you ^^ 



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-query-for-multiValued-Field-tp4022600p4022628.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr : query for multiValued Field

Posted by Erick Erickson <er...@gmail.com>.
Your problem doesn't have anything to do with positionIncrementGap, it's
the "string" type
of the field. The string type is completely unanalyzed, so you have _single
tokens_
like "Paul Bettany", "Harrison Ford" etc which do not match "Ford" at all.

I suspect the reason you're getting matches is that when you search q=Ford,
you're actually
searching the default search field which _does_ have single tokens like
"Ford" in it.

Try attaching &debugQuery=on to the URL and you'll see some evidence for
this. Also, the
admin>>analysis page can help greatly.

But the short answer is tot change the string type to a solr.TextField,
reindex, and try again.

Best
Erick


On Tue, Nov 27, 2012 at 7:23 AM, Scatman <al...@sfr.com> wrote:

> I got a little problem with a query on multiValued field. I explain :
>
> i got about 2000 documents so i will not show them all :) but an interest
> point...
>
> when i make this query : "q:Ford" i got 8 answers with 4 that Ford is in
> the
> actor field (who is an multiValued field)
> I try to make "q=actor:Ford" (even with fq) in order to get this 4
> documents
> but i got 0 matching
> i had searched some answer but i only find the tip who is to change the gap
> value ( more than 100)... but doesnt work for me...
> Here the field in schema.xml :
>
>                  <field name="actor" type="string" indexed="true"
> stored="true" multiValued="true"/>
>
> Here the format in the document :
>
>                 <field name="actor">Paul Bettany</field>
>                 <field name="actor">Harrison Ford</field>
>                 <field name="actor">Virginia Madsen</field>
>                 <field name="actor">Robert Patrick</field>
>
> Thanks for your help in advance :)
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-query-for-multiValued-Field-tp4022600.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>