I won’t have order: Looking at search libraries without ordering
For my needs, I’m mostly interesting in being able to under this type of query:
from Users
where City = ‘London’
order by LastLogin
I already looked at a few of these, as you can see in past posts. However, as I was trawling through the internet (or, more precisely, though various GitHub projects) I found quite a few search libraries that don’t have ordering support.
For example:
Why would anyone build such a system? Isn’t order by important?
Well, yes and no. In practice, all the libraries I found that skip explicit order by do that for a few good reasons. First, they are focused on IR (information retrieval) rather than queries. In other words, they all absolutely do ordering, but they do that based on how closely they were able to match the results to your query. For such a system, sorting by a different field is not meaningful. You want to have the most relevant results.
The other reason is that ordering by a arbitrary field, unrelated to the query, is tough. You have to explicitly keep track of additional information to be able to do that. IR is already complex enough, and in many cases, what you are searching on is a huge corpus of unstructured (at best, semi structured) data. You can’t afford the cost of tracking more data or the time to try to sort potentially many millions of results.
Comments
that's why google (and other search engines, if there are any :) doesn't have a "sort" drop down. Custom search has the ability to sort, but specifically due to the expectation of structured data.
It is possible to sort by a specific field with tantivy, but you have to write a few lines of code.
I will probably at the functionality at one point.
Paul, I didn't see that in the docs or in the code. Can you provide me a reference for this?
Comment preview