i thought of the possibility to extend the global full text search that sits on the upper right corner to work exact like the “Spotlight search” on the mac. For those that are not aware of the functionality i attached an picture. Basically it is just a autocomplete feature like google e.g. does it on the search bar.
My question would be how to extend the functionality in general, but additionally what that would mean this for a “normal” lucene index to give live results on every keystroke (or with a delay with 1-2 seconds). Perhaps it would be possible to limit the search results in this case on just what can be seen (as it is part of the instance name).
A selection of a particular result would open the editor for this instance, just like the click on the instance name of the result page.
What do you think of this idea? Even if it would not be you want to implement, can you elaborate a little bit on how generally something like this (out of band UI changes) could be implemented?
Also, I think it can be implemented right in your project. Look at the following things:
com.haulmont.cuba.web.gui.components.mainwindow.WebFtsField - it’s the search field that you see on the main window. As you see, it’s just a text field with a button that calls the ftsSearch screen. You can extend your main window and replace it with another component.
The ftsSearch screen is defined in the com.haulmont.fts.web.ui.results.SearchLauncher class and is again very simple (it’s not even a screen but Callable). It obtains FtsService and invokes its search() method which returns SearchResult object. This object is passes to the ftsSearchResults screen which actullly shows results.
So I think it is possible to reproduce the process up to where you get SearchResult and then show results in a different manner.
Regarding performance, take also in consideration that all found entities are checked for availability for the current user by applying row-level security constraints and reloading instances. Now it is done regardless of whether contraints exist for the entity or not, but we can do it smarter in the future.
Another problem that you will probably face is how to react on each key press in the search field. Now the TextField component changes value only on Enter press or loosing focus. Actually, we have been asked for such feature several times, so we are going to make some investigation and offer a solution in the near future.