AutoSuggest

SearchBlox Indexed Data Based Autosuggest

  • Suggestions can be fetched from content or title field of indexed data
  • Content-Based Autosuggest fetches suggestions from the content indexed. If the user wants to enable this in the search, then the selection has to be made in Search Settings as shown:
603
  • Title-Based Autosuggest fetches suggestions from the title field indexed. If the user wants to enable this in the search, then the selection has to be made in Search Settings as shown:
609
  • Response of Title field suggestions:
1861

🚧

Important Information

Kindly note that it is mandatory to select the Autocomplete field in search settings for the suggestions to be fetched from the title or content in AutoSuggest Servlet mentioned in the preceding section.

ParameterDescription
qQuery
colCollection Number
Absence of the collection field will fetch suggestions from all collections
cnameCollection Name
Absence of the collection field will fetch suggestions from all collections
limitNumber of suggestions per page

SearchBlox Query-Based Autosuggest

  • Suggestions can be fetched from past queries made by the user.
  • Query-Based Autosuggest fetches suggestions from the past queries logged in the querylogs index. If the user wants to enable this in the search, then the selection has to be made in Search Settings as shown:
606

🚧

Important Information

It is not mandatory to select the autosuggest field as the query in search settings as providing the cname as searchlogs will fetch suggestions from querylogs irrespective of the selection made in search settings Autocomplete field.

qquery
cnameThe cname value has to be searchlogs for fetching suggestions from querylogs
limitNumber of suggestions per page
  • Autosuggest Search for Querylogs(cname for Querylogs is searchlogs)
    JSON Reponse:
    [{"0":"news","1":"news and videos","2":"news around the world","3":"news world"}]

AutoSuggest in Faceted Search

  • Autosuggest/Autocomplete is enabled by default in faceted search.
  • This feature can be disabled by making the change in <SEARCHBLOX_INSTALLATION_PATH>/webapps/searchblox/plugin/facet.js by providing false as value for the field showAutoSuggest as shown:
    "showAutoSuggest": false,
  • The number of autosuggest values in default faceted search would be 5.
801
  • The source of suggestions can be selected in Search Settings as mentioned in the previous sections.
598

AutoSuggest Servlet Parameters

SearchBlox ParametersDescriptionGSA Equivalent
qPartial query for which the suggestions are displayedq
limitThe maximum number of results that the Auto-suggest servlet should return.
Default value is 10.
max
colcollection numbersite
cnamecollection namesite

Custom Autosuggest

  • In SearchBlox it is possible to configure AutoSuggest for specific fields other than content or title or querylogs.
  • These specific fields could be SearchBlox fields or custom fields indexed in SearchBlox.

Custom Autosuggest for Custom Fields

Autosuggest or autocompletion can be enabled for a custom field using the following steps:

  1. Go to <SEARCHBLOX_INSTALLATION_PATH>/searchblox/webapps/searchblox/WEB-INF/
  2. Make changes in mapping.json or jdbc.json or csv.json depending on the collection from which the field is used for AutoSuggest. To learn more on mapping and collections associated read: Mapping Files for Collections
  3. Give the following mapping in the custom field:
"author": {
        "type": "completion"
      },
  1. Clear and reindex the collection with the field.
  2. Select Autocomplete Field as Title or Content.
  3. Check the autosuggestions with the following URL and params in AutoSuggest Servlet
    https://localhost:8443/searchblox/servlet/AutoSuggest?q=speaker&type=custom&field=author

Custom Autosuggest for SearchBlox Fields

Custom Autosuggest can be used for SearchBlox fields as in the following steps:
Let us consider that autosuggest is to be used for the description field, it can be done in two ways:

Providing Subfield within the Actual Field

  1. Go to <SEARCHBLOX_INSTALLATION_PATH>/searchblox/webapps/searchblox/WEB-INF/
  2. Make changes in mapping.json or jdbc.json or csv.json depending on the collection from which the field is used for AutoSuggest. To learn more on mapping and collections associated read: Mapping Files for Collections
  3. Give the following mapping in the description field:
"description": {
         "type": "text",
        "store": true,
        "analyzer": "sb_analyzer"
        "fields": {
          "desc": {
            "type": "completion"
          }
        }
      },
  1. Clear and reindex the collection.
  2. Select Autocomplete Field as Title or Content.
  3. Autosuggestions can be fetched based on description field using description.desc as in the following URL
    https://localhost:8443/searchblox/servlet/AutoSuggest?q=y&type=custom&field=description.desc

Copying to a New Field

  1. Go to <SEARCHBLOX_INSTALLATION_PATH>/searchblox/webapps/searchblox/WEB-INF/
  2. Make changes in mapping.json or jdbc.json or csv.json depending on the collection from which the field is used for AutoSuggest. To learn more on mapping and collections associated read: Mapping Files for Collections
  3. Give the following mapping in the description field and test field:
"description": {
         "type": "text",
        "store": true,
        "analyzer": "sb_analyzer"
        "copy_to": "test"
              },
        "test": {
            "type": "completion"
            },
  1. Clear and reindex the collection.
  2. Select Autocomplete Field as Title or Content.
  3. Autosuggestions can be fetched based on the description field using field test as in the following URL:
    https://localhost:8443/searchblox/servlet/AutoSuggest?q=y&type=custom&field=test
888