Getting Started : Creating a Simple Search Application : Configuring the Search Bar Behavior
 
Configuring the Search Bar Behavior
 
Use Full-Text Search
Use Prefix Search to Make Specific Queries
Use Semantic Analysis to Correct Queries
Once the data model is created, you can specify the behavior of your application search bars, that is to say what will your end-users be able to do when entering search queries, how will you help them to correct their queries or to choose a relevant query.
Use Full-Text Search
Use Prefix Search to Make Specific Queries
Use Semantic Analysis to Correct Queries
Use Full-Text Search
We call full-text search, a user query that does not contain any prefixes. By default, when you enter a query, Exalead CloudView searches the content of the text index field.
In addition to their specific index fields, all properties set to searchable without prefix, also send their content to the text index field. This allows users to search this property without specifying a prefix in the query.
For example, cropped trousers is a simple query for which Exalead CloudView will search for the term cropped, the term trousers, and the combination of these two terms.
The following tutorial shows how to use full-text search with Boolean operators
You are certainly familiar with common query operators, like:
Quotes "" to search for exact phrases. For example, “cropped trousers” will search for the exact expression, not for cropped and trousers separately.
OR to search for either one term or another. For example, cat OR pet.
AND to search for one term and another term.
Note: Blank spaces are interpreted as AND implicitly.
And maybe also "-" (minus sign) to exclude a term from the search. For example, new -york will search for documents containing new but not york.
Exalead CloudView provides these operators and many others in its User Query Language (UQL), the natural language used for queries. You can use these operators to make simple or rich queries by combining them. For more information, see "User Query Language (UQL)" in the Exalead CloudView Configuration Guide.
1. Go to the Mashup UI: http://<HOSTNAME>:<BASEPORT>/mashup-ui
2. In the Search field, enter: trousers OR shirt NOT "t-shirt"
Search results display hits for occurrences of trousers and shirt found in the name and description fields (which we set to searchable without prefix in Create a New Class in the Data Model).
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.
a. In the Administration Console, go to Search > Search Logics > Query Language.
b. Expand the sales_unit_price prefix handler.
c. Click Customize.
d. In the Aliases field, add price as new alias. If you want to enter several aliases, separate them by commas WITHOUT space.
e. Click Apply.
f. 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.
Use Semantic Analysis to Correct Queries
To be able to provide relevant search results when the user's query is incomplete, misspelled, or imprecise, Exalead CloudView performs a semantic analysis of documents as well as the queries themselves. This generates word matching operators and fuzzy matching options.
For example:
Did you mean? Spell check: exalaed will prompt Did you mean: exalead?.
Approximation: exalaed will match exalead.
Phonetic spelling: exaleed will match exalead.
Word truncations: exal* will match Exalead, exalid exalted.
Regular expressions: /exa.ead/ will match exalead and exahead.
For more information, see "More About Semantic Analysis" in the Exalead CloudView Configuration Guide.
Depending on the semantic feature, the analysis takes place either at indexing-time, or at search-time.
Index-time: analyzes documents just before indexing, using semantic processors. Anytime you modify semantic processors, you must always reindex your documents before the change will appear in your application.
Search-time: analyzes the user's search request, known as query expansion, which essentially adds additional search terms to the user's original query. For example, if phonetic query expansion is enabled, the query exaleed will be expanded to "exaleed" OR "exalead".
Note: The following tutorial example explains how to configure semantic processing at search time. We will enable approximation for full-text search, to correct user queries with typos. For example, if the user enters croped, the search results will display hits with cropped, the correct spelling, automatically. To enable approximation, we must modify the query expansion configuration for the text: prefix. For details on configuring semantic processing at index-time, see the Exalead CloudView Configuration Guide.
Search Without Approximation
1. Go to the Mashup UI: http://<HOSTNAME>:<BASEPORT>/mashup-ui .
2. In the search bar, enter: croped and click Search
Records do not display in the search results as the word is misspelled.
Enable Approximation
1. In the Administration Console, go to Search > Search Logics > sl0 > Query Expan­sion.
2. Under Query Expansion Modules, verify that an approximate module appears in the list. If not, add one by clicking Add module.
3. Go to the Query language tab.
4. Click the text prefix handler.
a. Beside Query expansion config, click Edit.
b. In the Query expansion config window, double-click the approximate module.
c. Click Accept.
5. Click Apply.
Search with Approximation
1. In the Mashup UI, search for croped.
This time, records are displayed in the search results, since Exalead CloudView expanded the query with approximation to get the correct orthograph for all fields that have a text semantic type. This is the case for the description and name fields in our example.