Frage

Is there a way to limit, or filter, the returned text of a multivalued field in Solr? Given the following document structure in Solr:

...
<doc>
    <str name="title">example</str>
    <arr name="foo">
        <str>bar1</str>
        <str>bar2</str>
        <str>bar3</str>
        <str>bar4</str>
        <str>bar5</str>
        <str>bar6</str>
    </arr>
</doc>
...

I'd like to limit the response to only show 1 of the "foo" values based on a Filter Query request. So for example, the query:

select/?q=example&fq=foo:bar2`

I would want a response of:

...
<doc>
    <str name="title">example</str>
    <arr name="foo">
        <str>bar2</str>
    </arr>
</doc>
...
War es hilfreich?

Lösung

Nope. There is not way to filter the Multivalued Values returned with the response.
You can easily do it at client side though.

If you can use Facet to get the list, you can use facet.prefix to limit the values for the field foo returned as facet.

Andere Tipps

Did you try using dynamic fields if you know the sample space of values for 'foo'? For example:

and then filter on bar_x:true. You would end up using a large number of dynamic fields.

filter query should work, try below code

&fq=+foo:"bar2"

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top