Thought of another way to do this which will at least work for one field,
and that is by mapping all of the values into a simple string field and
then querying for an exact match in the string (one term).  This is similar
to having a 'count' field, but for our index creation process we could
reuse a string field we already had made (for sorting).  Still, I'd like to
see if the community has any other options from within Solr itself.


On Thu, Jan 26, 2012 at 2:05 AM, bilal dadanlar <bi...@fizy.com> wrote:

> I am having a similar problem and would appreciate any useful explanation
> on this topic.
> I couldn't find a way of querying for "exact match" in multivalued or
> normal text fields
>
> On Thu, Jan 26, 2012 at 3:14 AM, Garrett Conaty <gcon...@gmail.com> wrote:
>
> > Does anyone know if there's a way using the SOLR query syntax to filter
> > documents that have only a certain value in a multivalued field?  As an
> > example if I have some field "country" that's multivalued and I want
> >
> > q=id:[* TO *]&fq=country:brazil       where 'brazil' is the only value
> > present.
> >
> > I've run through a few possibilities to do this, but I think it would be
> > more common and a better solution would exist:
> >
> > 1) On index creation time, aggregate my source data and create a
> > "count_country" field that contains the number of terms in the country
> > field.  Then the query would be q=id:[* TO
> > *]&fq=country:brazil&fq=count_country=1
> >
> > 2) In the search client, use the terms component to retrieve all terms
> for
> > "country" and then do the exclusions in the client and construct the
> query
> > as follows q=id:[* TO
> > *]&fq=country:brazil&fq=-country:canada&fq=-country:us   etc.
> >
> > 3) Write a function query or similar that could capture the info.
> >
> >
> >
> > Thanks in advance,
> > Garrett Conaty
> >
>
>
>
> --
> Bilal Dadanlar
>

Reply via email to