A search result can contain a summary, which is a small number of selected sentences, centered around the query terms. You can typically configure how long it is and whether to highlight search terms in its content.
Note: You can apply a summary on any meta, but it mostly applies to the text meta.
1. In the Administration Console, go to Search > Search Logics > SearchLogic > Hit content.
2. Click a meta to display its settings.
3. In the meta settings, click Customize.
4. Select the Summary check box.
5. Expand Operations, and expand Summary.
Configure the summary as required. For details on summary options, see the tooltips.
6. Click Apply.
Configure Value Selection for Metas
You can configure the number of values that are displayed for metas in hit content. This is typically useful to restrict the number of values retrieved from multivalued fields. Especially when you do not want to clutter hit content with too many values for a given meta.
Set the Value Selection
In the Administration Console, when you go to Search > Search Logics > SearchLogic > Hit content and select a meta, you can add the Value display selection operation. This operation has two required settings:
• Min. values – minimum number of values to display for the meta in the hit content. If set to 0, no value is displayed if there are no matching values. If set to more than the number of matching values, some nonmatching values are displayed in addition to the matching values.
• Max. values – maximum number of values to display for the meta in the hit content. It selects the n first values. For examples, if you set it to 10 and the query matches more values, only the first 10 values are displayed.
Note: It is a stand-alone feature but you can associate it with the highlight or the summary operations.
Value Selection Use Case
We consider a corpus of cooking recipes where you have an ingredients meta, which comes from a multivalued index field.
The problem is that this meta displays by default all the ingredients found in the documents matching your queries, and not only the relevant ingredients. You may thus get extra-long hits with metas containing hundreds of worthless values.
If we search for "curry AND paprika AND chicken", what we expect is to see these 3 ingredients, as values of the ingredients meta.
If we want to display at least these 3 ingredients, and then possibly a few other ingredients retrieved randomly, we can for example, define a Value selection on the ingredients meta, with Min. values to 5 and Max. values to 5. The ingredients meta displays: curry, paprika and chicken and 2 other ingredient values in the order they are retrieved from the document. For example, your meta may display as follows: ingredients: curry, cardamon, paprika, coriander, chicken
If we want to display matching values only, we must set Min. values to 0. We get: ingredients: curry, paprika, chicken in the order they are retrieved from the document.
If we want to display 3 matching values, and at least 2 values (whether matching or not), we set Min. values to 2 and Max. values to 3. We get:
• ingredients: cardamom, salt – if the document contains ingredient values cardamom, salt, pepper; since we set it to keep a minimum of 2 values whether matching or not.
• ingredients: cardamom, chicken – if the document contains ingredient values cardamom, salt, pepper, chicken; since we set it to keep a minimum of 2 values whether matching or not.
• ingredients: chicken, paprika – if the document contains ingredient values cardamom, chicken, paprika, salt, pepper, since we keep in priority matching values.
• ingredients: chicken, paprika, curry – if the document contains ingredient values cardamom, chicken, paprika, curry, salt, pepper, since we can keep a maximum of 3 matching values.
• ingredients: chicken, green curry, red curry – if the document contains ingredient values cardamom, chicken, green curry, red curry, paprika, salt, pepper, since we can keep a maximum of 3 matching values and the order in which values are retrieved is taken into account.
Configuring the Highlighting of Search Terms
A common search application requirement is to display the results with the matching terms highlighted, in bold or in a different color.
You can configure highlighting on any meta, but it mostly applies to the text and title metas, as they allow users to quickly identify whether the hit is interesting or not.
Highlighting Behavior with Prefix Handlers
By default when searching with a prefix handler, the matching terms are only highlighted in the hit meta of the same name.
Figure 13. Using the title: Prefix Handler, Matches are only highlighted in the Title Text.
You can, however, associate extra prefix handlers and facets for highlighting matching terms.
This is the case of the title hit meta, which is pre-configured with additional prefix handlers. This means that matching terms are highlighted in a document’s title when:
• Searching with the title: prefix handler. This is the default behavior described above.
• Searching with one of these prefix handlers: text:, soundslike:, or spellslike:. These are specified in the title hit meta setup as extra prefix handlers.
Figure 14. Using the text: Prefix Handler, which is an extra Prefix Handler for the title Hit Meta, Matches are highlighted in the Title, as well as in the Summary Text.
Deactivating the Highlighting for a Subquery Node
In specific use cases, you may want to disable the highlighting and the summary for a specific node of your query only. In other words, you want the highlighting/summary to be activated for the overall query and deactivated for a subpart of it.
This can be specified in both UQL and ELLQL languages by appending the {hl=0} parameter to the node that must not be highlighted. For example, to highlight New York but not city in the UQL query New York city, we can enter the following query: New York city{hl=0}
Note: You could also change the query template in Search > Search Logics > Your search logic > Query Template, to exclude a subquery node globally by appending the {hl=0} parameter to #query
Setting Up Hit Highlighting
This section describes how to highlight matching search terms in result hits.
Display and Configure a Hit Highlight
1. In the Administration Console, go to Search > Search Logics > yourSearchLogic.
2. On the Hit Content tab, click a meta to display its settings.
3. In the meta settings, click Customize.
4. Select the Highlight check box.
5. Expand Operations, and expand Highlight.
Configure the highlight as required. For details on highlight options, see the tooltips.
6. Click Apply.
Specify Extra Prefix Handlers or Facets for Highlighting
1. In the Administration Console, go to Search > Search Logic > yourSearchLogic.
2. On the Hit Content tab, click a meta to display its settings.
3. In the meta settings, click Customize.
4. Expand Operations, click Add operation, and then select Highlight.
a. For Extra prefix handlers for highlight, enter the names of the additional prefix handlers, separated by commas (the list of prefix handlers is on the Query Language tab).
b. For Facet ids for highlight, enter the facet names, separated by commas.
5. Click Apply.
When you search using these prefix handlers or facets, matching search terms in this hit meta are highlighted.