Use Prefix Search to Make Specific Queries

Prefix handlers allow you to refine queries by targeting specific index fields or change the behavior of the query expansion. For example, the title: prefix handler allows you to refine the search on document titles.

Prefix handlers are created automatically when you add data model properties.

This tutorial explains how to use prefix search (using prefix handlers) to target specific index fields. This gives us a means to search for data very precisely. For example, we can search for all articles with a given price using the sales_unit_price prefix (where sales_ is the parent class of the unit_price property).

  1. Go to the Mashup UI: http://<HOSTNAME>:<BASEPORT>/mashup-ui .
  2. In the Search field, enter: sales_unit_price<15

    All the articles with a price lower than 15 are displayed.



  3. sales_unit_price is not very handy for our prefix search, and we want to be able to use this prefix handler with price only.
    1. In the Administration Console, go to Search > Search Logics > Query Language.
    2. Expand the sales_unit_price prefix handler.
    3. Click Customize.
    4. In the Aliases field, add price as new alias. If you want to enter several aliases, separate them by commas WITHOUT space.



    5. Click Apply.
    6. In the Mashup UI, you can now search for price: 14.99
  4. Now let us combine prefix search with Boolean operators. Enter the query: sales_firstname: Dean sales_lastname: salas shirt NOT “t-shirt”

You will see all shirts sold by Dean Salas, but not t-shirts.