search ordering
Feedback for search - ordering is important. In my case the search is over a set of transactions listed by date. Once you type in the search box, order becomes random (from the user's perspective).
8 Replies
hey @erquhart, yeah this is super helpful. we'll be picking up work on full text search again shortly 🙂
the ordering right now is based on relevance, so documents that match more of the search terms will sort higher. is there a natural way to combine these two orderings for your app?
so, for example, would it make sense to take, say, the 10 most relevant documents and then resort those by date?
Ah I see what you mean, hmm... I guess you'd have to get the entire set of adequately relevant documents for this to work
Or apply ordering and then just return page-able documents without relevance sorting
Losing relevance sorting is a fair compromise when this is needed imo
I guess this is more of a "filtering", where order has to not change (and an empty search string is valid)
yep, that totally makes sense. then it'd probably be just a regular database index to iterate in date order and then filter out matches from there.
if you did want to stick with relevance order -> resort, one idea we've been playing around with is returning the score in the search result. that way, you could pick a cutoff score for which documents are adequately relevant and not have to take a fixed number. taking the 10 most relevant results may not be that good of a user experience if none of them actually really match.
Yeah that makes sense. I think for the current version of search my use case works with the current pass/fail, but scoring would probably become more pivotal for fuzzy matching.
(I mean my use case would work with ordering and without scoring, that is)
For now my paginating query is standard when there's no query string, and otherwise returns a fake page object with
isDone: true
and uses take(n)
+ js sorting. Should work for the interim.@sujayakar any update on this? I'd like to search for documents then order the results based on dates before calling
.paginate()
hey @faluyiHype, is your use case similar where you don't want to sort by relevance?
for example, given a search query "convex search," you'd want to find all of the documents that contain "convex" or "search" and then sort those documents based on their date?'
Hmm not fully understanding how “relevance” makes it different here but yes I’d like to search for text in a field of a document then sort all the results of that search in a order based on a date
sorting by relevance (the closest matches come first) is different than sorting by date or some other field. Currently search in convex only sorts by relevance.
so if you paginate, you'll get the closest matches, some will be old dates, some will be new dates. so as you add pages, if you're sorting everything by date, the whole list will keep changing rather than pages being appended.