Sebastian Nowak
Sebastian Nowak

Reputation: 3

Get only one matching row from Solr array

How do I get only a row which matches my query: ?q=taxonomy_ids:1/636/*

Got that result:

Want only: <str>1/636/587</str>

Upvotes: 0

Views: 203

Answers (1)

Alexandre Rafalovitch
Alexandre Rafalovitch

Reputation: 9789

There is no easy way. However, there is a trick, where you use a match highlighter and use those results instead of the results returned from the search itself. You may want to configure PRE/POST highlight tags to empty strings. There was an article on the web about somewhere, but I can't find it again.

The disadvantage is that you get your results twice. Once as docs and once as highlight.

The other option is a custom component that hooks into Lucene's explain structure.

Upvotes: 1

Related Questions