Advanced Query Syntax Support for OpenMRS AddOns

Tags: #<Tag:0x00007f076b985f98>

Hi all,

Search is an important component of OpenMRS AddOns,. As the number of modules increase, an easy and efficient search mechanism becomes ever so important. As a step towards improving the search experience for a user, we would like to add support for advanced query syntax.

Now, advanced query syntax is something that is supported by even the biggest search engines out there like Google Search , Microsoft Bing among others. This method helps narrow down the results of the search based on what exactly the user is looking for.

Here is an example of an advanced query syntax:

     type: OMOD tag:Metadata Reference

The result of the search only contains all modules containing the name “Reference”, has “Metadata” as its tag and is an OMOD. Currently, our index only has one module with all these characteristics(Reference Metadata Module).

Thus, in this case, a simple query would have included a number of search results which are not even relevant to the user, with advanced query syntax support, the user can ensure that they can specify their requirements and be presented with results that adhere to those requirements only.

Jira Issue : AO-22

cc: @darius @ruhanga

Please find the updates for this feature below:

Link to initial PR

Screenshots:

In the examples below, the search query used is “Reference”. The user intends to search for the Reference Metadata Module.

Search results on using advanced query syntax:

Search results without advanced query syntax/simple query:

Kindly note, this feature does not change how the existing search algorithm works(that’s a different task). It just adds some more ways to narrow down search results

Thank you very much @reubenv :slight_smile:

One suggestion I have for this is for there to be a way to have the different search terms auto-completed or given options in a dynamic drop-down with existing alternatives as the user types to help prevent typos in the whole query where the user thought everything was typed correctly.

This is cool! Thoughts:

  1. We need a help link which gives the supported syntax.
  2. We should support at least these also:
    • moduleId
    • status
    • name
  3. I would expect we support some of the typical advanced search things like "exact phrase" and -exclude.