fergiemcdowall / norch

A search server that can be installed with npm
655 stars 45 forks source link

Categorize: Sorting a category on amount of document hits? #145

Closed eklem closed 4 years ago

eklem commented 7 years ago

Is it possible to query /categorize and get back a stream sorted on amount of hits instead of by alphabet?

http://oppskrift.klemespen.com:3030/categorize?q={"pageSize":10,"category":{"field":"Varetype"},"query":{"AND":{"*":["eple"]}}}

gives me:

{"key":"*","value":315}
{"key":"brut","value":104}
{"key":"champagne","value":112}
{"key":"extra","value":15}
{"key":"musserende","value":203}
{"key":"rosé","value":16}
{"key":"sec","value":3}
{"key":"vin","value":203}
fergiemcdowall commented 7 years ago

Going to have a look at this. It would be great, and consistent, if /categorize could parse offset, pageSize, and sort

eklem commented 7 years ago

If sort also would work on regular search results, that would be sooo nice =). Then you could do alphabetical sorting on names, and geographical(numerical) sorting on distance