Yet another searching technique!

Oracle APEX has made it extremely easy to search for your data. Faceted Search in Oracle APEX 19.2 was the recent addition to the pursuit of achieving an excellent way to find what you want quickly and efficiently. In Oracle APEX 21.2, we continue the journey by introducing a new component called Smart Filters.

Smart Filters and Faceted Search share a lot in common. They are built using the same architecture and both fulfil the goal of finding faster with less. The following are some areas where both components share:

  • The two components have filterable items. In Faceted Search, we call them facets, and they are called filters in Smart Filters.
  • Both support the same search results’ regions:
    • Classic Report 
    • Cards 
    • Calendar 
    • Map
  • The two components have a similar set of attributes such as: 
    • Multiple Values Type
    • Depending On Filter/Facet
    • List Entries

The User Interface

Before showing how to build the application lets look at what smart filters looks like and how to use it. Smart Filters consists of two main top-level containers: Search Bar and Suggestion Filter Chip Container. You can optionally add a total row count label as well.

The user interface is highly compact. The moment you start typing, all the filters show up with potential matched values. Hitting the Enter key will apply a certain selected value creating an Applied Chip.

The interface supports small screen devices by providing overflow chips saving screen space.

The Suggestion Filter Chip Container contains the suggested chips. When a filter has a list of values the default Suggestions Type, Dynamic, will pick the one with the highest count (or first if counts are turned off). But if the filter type is Input or a Range with only manual input nothing is chosen by default. You have to use static values or SQL query Suggestions Types and add a specific suggestion value.

Suggestions Types can be based on Dynamic, Static Values, or SQL Query. Suggestions for a particular filter can be turned off by setting its Suggestions Type to None.

By default, five chips will show. This property can be overridden by the builder. You can also allow showing a button titled More Filters to show less important filters. The below example will clarify those settings in more detail. 

The Smart Filters support navigation with keyboard keys. Navigation arrows allow you to move easily between the different Applied Chips or the Suggestion Chips, while the Tab key navigates you to the values. Enter and Delete/Backspace keys can be used to apply or delete a selected filter value.

Example

 In this article, I have used the HR Dataset to view the capabilities of Smart Filters. The dataset can be installed by navigating to SQL Workshop => Utilities => Sample Datasets and clicking the Install button.

We will build an example to search for our employees based on different attributes.

Let’s create a new Smart Filters page. The page can be created using a Page Creation wizard. Click the Report icon. Smart Filters is found under the group Report.

Click the Smart Filters icon.

Set the Dispay as property to Cards. If you need to have another report type such as Maps you can do that manually in Page Designer. Note that we will use the OEHR_EMP_DETAILS_VIEW as a local database view. The view is part of the HR Data sample dataset which we installed earlier. We will enable the following filters:

  • DEPARTMENT_NAME
  • JOB_TITLE
  • CITY
  • STATE_PROVINCE
  • COUNTRY_NAME
  • REGION_NAME

Click Next and continue to the end of the wizard. This brings you to Page Designer where you can see the configuration of the smart filters and report regions.

In Page Designer, we will create another filter manually by right-clicking on Filters. The Filter will be used to provide a range of searching functionalities for the Salaries of the employees.

The following illustrates the different properties to be applied for the Salary filter.

We will set the Search Region’s Attributes tab values as follows. Notice that the Maximum Suggestion Chips count is null. This will set it to the default value of five. We will enable the More Filters Suggestion Chip property, set Show Total Row Count to Yes, and change the label Total Show Count Label to Employees Count.

The Search Results region’s properties under the Attributes tab can have the following values.

To distinguish each Filter, we could use the following list of icons.

Filter Appearance => Icon
P3_REGION_NAME     fa-globe
P3_COUNTRY_NAME     fa-map-o
P3_STATE_PROVINCE     fa-map-markers-o
P3_CITY     fa-map-marker-o
P3_DEPARTMENT_NAME     fa-users-alt
P3_JOB_TITLE     fa-wrench
P3_SALARY     fa-money

The final look and feel of the Smart Filters will look similar to this image.

If you click on the Region Name section of the suggestion chips, you will be able to select values. Alternatively, if you click on the Americas section of the Region Name chip, the value will be applied automatically.

You can click on More Filters button to show the hidden filters.

For instance, we could select the Salary Filter and provide a range of salaries to look for.

Smart Filters support multiple Search Terms.Let’s search for United and Programmer. We will see how the Search Results regions get updated, fetching the related data.

Differences

Smart Filters is not a replacement for Faceted Search, we continue to enhance both, and that they both have their uses depending on what kind of UX you prefer. The biggest difference between Smart Filters and Faceted Search is the User Interface. Smart Filters component occupies much less space and is highly suitable for small screen devices. 

The following are some differences between the two components:

  • No Initially Collapsed attribute and no Show Chart capabilities in Smart Filters
  • Faceted Search lacks the following capabilities that are currently unique to Smart Filters only: 
    • Multiple Search Terms allow end-users to type free text searching all the Filters. (Requires Image)
    • Search field combo box with drop-down entries to select from is only available for Smart Filters.
  • Smart Filters currently do not have the following as entry input types:
    • Select List.
    • Groups of Single Checkboxes.
    • Batch Option where you can do multiple changes at the client-side and push them as a batch at once to the server.
    • Clearing specific values is faster in Faceted Search with one click vs. two clicks for Smart Filters.
    • Clearing all Facets in Faceted Search can be done in just one click where you require several interactions to clear all the Filters in Smart Filters. 

Conclusion

Oracle APEX continues to find innovative ways to visualize and make searching for data easier. The Low-Code concept is what drives the APEX team to create more components thriving for a better user experience in a fraction of a time.