Search code examples
solrmaxminimum

Solr - How to get a document that has the minimum price


I have a Solr instance which contains documents that represent products. Each document has a UnitPrice attribute associated with it, which is of type float, in the schema.xml.

Is it possible to perform a query the would return me a document that has the minimum price? I would also like to find the document that has the maximum price. Is this at all possible?


Solution

  • q={!lucene}*:*&sort=UnitPrice+asc&rows=1

    This will return the first result of a MatchAllDocsQuery sorted by price.