18
votes

Can I, within a Solr function query, count the number of values in a multivalued field? How would I write a function query that returns documents with, say, 3 or more values for a particular field?

1
just to help someone: myField:[* TO *] returns if has more than 0 values. - Topera

1 Answers

16
votes

Here's the function query reference, and it doesn't list anything like that, so I think it's safe to assume that there's no such thing.

If the value count is somehow relevant in your case, add it as a separate int field, then operate on that field.