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 Fredouille91 <f....@mb-line.com> on 2010/02/15 09:47:42 UTC
Filtering a string containing a certain value with fq ?
Hello,
I have a field (named "countries") containing a list of values separated
with comma to wich belongs each document.
This field looks like this : france,germany,italy
It means that tjhis document is related to France, Germany and Italy.
I 'm trying to add a filter to list, for example, all documents only related
to Germany but I don't know how to specify it in my fq parameter.
I tried these syntaxes without success (I'm using disMaxQuery):
fq=countries:germany => 0 results
fq=countries:%germany% => 0 results
fq=countries:*germany* => error '*' or '?' not allowed as first character
in WildcardQuery
fq=countries:germany* => 0 results but it seems that it lists only the
fields beginning with germany
What is the correct syntax ?
Thanks for your help,
Regards,
Fred
--
View this message in context: http://old.nabble.com/Filtering-a-string-containing-a-certain-value-with-fq---tp27590860p27590860.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Filtering a string containing a certain value with fq ?
Posted by Fredouille91 <f....@mb-line.com>.
Koji Sekiguchi-2 wrote:
>
> Fredouille91 wrote:
>> Hello,
>>
>> I have a field (named "countries") containing a list of values separated
>> with comma to wich belongs each document.
>> This field looks like this : france,germany,italy
>> It means that tjhis document is related to France, Germany and Italy.
>>
>>
> If you can have country field as multiValued="true" and index the
> list of countries:
>
> <country>france</country>
> <country>germany</country>
> <country>italy</country>
>
> rather than <countries>france,germany,italy</countries>, you can
> just filter by fq=country:germany.
>
> Or you can index <countries>france germany italy</countries>
> and use WhitespaceTokenizer for the countries field, then you
> can just filter by fq=countries:germany.
>
> Koji
>
> --
> http://www.rondhuit.com/en/
>
>
>
Thank you for your answer.
Your solutions are really interresting. I'll try the second one.
Fred
--
View this message in context: http://old.nabble.com/Filtering-a-string-containing-a-certain-value-with-fq---tp27590860p27593402.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Filtering a string containing a certain value with fq ?
Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Fredouille91 wrote:
> Hello,
>
> I have a field (named "countries") containing a list of values separated
> with comma to wich belongs each document.
> This field looks like this : france,germany,italy
> It means that tjhis document is related to France, Germany and Italy.
>
>
If you can have country field as multiValued="true" and index the
list of countries:
<country>france</country>
<country>germany</country>
<country>italy</country>
rather than <countries>france,germany,italy</countries>, you can
just filter by fq=country:germany.
Or you can index <countries>france germany italy</countries>
and use WhitespaceTokenizer for the countries field, then you
can just filter by fq=countries:germany.
Koji
--
http://www.rondhuit.com/en/