Tom5
Tom5

Reputation: 1

Sphinx - search more than doc. IDs

I'm searching with PHP Sphinx in my products database:

SELECT name, price FROM products

I'm searching only by name. I'm using pagination because I don't need all record at once ( ->SetLimits() ) so Sphinx return me e.g. only 10 ids.

But web user can filter searched items by price filter, so I need to know max and min price (from all records not just from records on one page) to show user price filter range.

Is it possible get from Sphinx MAX(price) and MIN(price) values from all searched decuments?

Upvotes: 0

Views: 265

Answers (1)

barryhunter
barryhunter

Reputation: 21091

Grouping/Clustering allows this http://sphinxsearch.com/docs/current.html#clustering

You run your normal text query, as we as another query to get the data you need.

If worried about performance, use multi-queries http://sphinxsearch.com/docs/current.html#multi-queries

Upvotes: 1

Related Questions