Hello,
During search implementation I faces few problems working on pagination. General flow should be like:
- Get total number of results with criteria
- Based on total number of rows show 30 items per page and show to user how many pages there is
- User passes 2 page I change LIMIT …
The way I was doing it with Sphinx is just do count query. Now, with manticore GEODIST() implementation, I tried some ways to solve it but it didn’t work.
Query can look like:
SELECT id AS ad_id, weight() AS relevance, created as posted_max, GEODIST(44.786568, 20.4489216, location_lat, location_lon, {in=degrees, out=miles}) AS location_radius FROM ad_complete WHERE MATCH(‘@(name,category_group_name) apple @(ad_tags) COURIERDELIVERYLOCALPICKUP’) AND (location_id IN(1,153,117,110,111,112,113,115,107,108,103,109) OR location_radius <= 10) ORDER BY relevance DESC LIMIT 0,30 OPTION field_weights=(name=8, description=3, category_group_name=1, adIdTag=6, topTag=9, priorityTag=5, normalTag=0),max_matches=19999,ranker=expr('sum((4lcs+10wlccs+(min_hit_pos==1)+word_count+2exact_hit+25tf_idf)*user_weight)100+10bm25+(((is_t…
I tried to do count query passing GEODIST in WHERE, it didn’t work. I also tried with sub queries but still could not get the result.
Is there a way I can combine GEODIST with count or is there any way to get total number of row by criteria including GEODIST?