Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Without the need to recompile Datafari or DatafariUI, you can add new suggesters in the autocomplete just by declaring them in the config file, as long as you do not want to declare a new type of suggester used in the backend (see the next chapter for adding a new type of suggester). You can get the list of currently implemented suggesters types by looking at this file: https://gitlab.datafari.com/datafari-community/DatafariUI/-/blob/dev/src/Components/SearchBar/Autocompletes/Suggester/useSuggesters.js

You also need to add the suggester into the file $DATAFARI_HOME/tomcat/conf/entity-autocomplete.properties see Adding entity autocomplete: from indexation to autocomplete and Autocomplete with Categories/Entities Configuration for more information for the configuration.

In the configuration below, we have 3 suggesters : 1 of type basic and 2 of type entity. The difference between the 2 entities suggesters here, is at the field, the name of the request handler used and titles parameters level, but it could also be at the subtitle level.

Code Block
languagejson
...
  "searchBar": {
    "suggesters": [
      {
        "type": "BASIC",
        "props": {
          "maxSuggestion": 5,
          "title": "SUGGESTED QUERIES",
          "subtitle": "Queries extending your current query terms",
        },
      },
      {
        "type": "ENTITY",
        "props": {
          "field": "authorTokens",
          "suggester": "suggestAuthors",
          "dictionary": "suggesterEntityAuthors",
          "asFacet": false,
          "maxSuggestion": 5,
          "title": "Entities suggested",
          "subtitle": "Queries extending your current query terms"
        }
      },
      {
        "type": "ENTITY",
        "props": {
          "field": "authorSocialSecurityNumber",
          "suggester": "suggestAuthorssuggestSocialSecurityNumber",
          "dictionary": "suggesterEntityAuthorssuggesterEntitySocialSecurityNumbers",
          "asFacet": false,
          "maxSuggestion": 5,
          "title": "Entities suggested by social security number",
          "subtitle": "Queries extending your current query terms"
        }
      }
    ]
  }
  ...

...

This requires developing new components in DatafariUI. Refer to the DatafariUI read me for more information on how to do that.

Define the list of

...

prefered sources

You can define a list of preffered prefered sources by adding a “sources” key to the ui-config object that holds an array of soruce source names, ordered in decreasing order of their importance.

...

Warning

This feature is not active yet (as of april April 2022). You can define you preferences, but no boosting will occur.

...