Implementing Omni Search
We have run a UX study on the RavenDB studio, and we have learned some interesting things about our own software. I’ll probably blog about it more in the future, in this post, I want to focus on one of the issues that was raised in the UX study. the search function. Here is how it looks now:
Is is a pretty simple feature. Given a prefix of a document id, show all the matches, and allow to go directly to the document.
In the UX study, the users utterly ignored the help text when the search box is empty and tried to put index names there to quickly find the relevant index.
This behavior makes… absolute sense. Of course they would assume that this is something that you can do.
So now we have new requirements for the search box:
- Allow to search for indexes or transformers or documents.
- Allow to search using contains, rather than starts with.
- Allow to search for functionality inside the studio.
This will allow the user to use the search box as the go to location to quickly do things in RavenDB.
The first item is pretty easy to explain, right? I can search for UsersIndex or Users/1. The second is a bit more problematic. In particular, given a database with several million documents, doing a contains query on the id is not practical. Oh, we can do a whole bunch of tricks around ngrams, preparing ahead of time, etc. But they aren’t worth it. This is a small feature, and we can’t have it costing us a lot during normal operations.
So we came up with the following design for how the search will work:
- Searching for indexes and transformers will use contains, because there are usually very few of those and it is cheap to do.
- Searching for documents will first:
- Try to find using the exact prefix (“users/’ will find “users/1”, “users/2”, etc)
- Then get the collection names and prepend them to the search term (so “123” will find “users/123”, “companies/123”, etc)
- Then get the collection names and prepend them to the search term and do a prefix query (so “123” will find “users/1234”, “companies/12345”)
The idea is that all of those are pretty cheap to do, and we can do them without running into high costs all over the place. And it will give you good way to jump around in your database and find the relevant stuff easily.
Finally, we have the 3rd requirement. What is that about?
Well, one of the things that we have found if that RavenDB has enough features that navigating through them has became a problem. For example, if you want to do a db restore, you need to go to Manage Your Server, then Restore. And it is something that users need to hunt for. The idea is that they can just put “backup” in the search box, and the option that will pop up is the backup screen. So you can skip the hunting through screen and “who moved my cheese” moments.
Comments
Yes! This is really great!
3 is particularly nice.
Should have used preview there. ;-)
Comment preview