...
The suggester
The suggester is used to try to predict that whether the user search term belongs to a category and propose a "special option" in the autocomplete to perform the user search in that specific category. If the user select that suggester optionselects the option proposed by the suggester, in addition to perform the performing this search in the category, Datafari may be able to change the way the results are displayed (depending on what was implemented in the code).
To configure a suggester for a category you will first need to create a new suggest request handler in Solr, based on the desired category field. Then you will need to edit AUTOCOMPLETESUGGESTERS variable in the configuration file DATAFARi_HOME/tomcat/conf/entity-autocomplete.properties :Code Block AUTOCOMPLETESUGGESTERS=[{"i18nKey":"asAuthor", "serverUrl":"", "servlet":"suggestAuthors", "maxSuggest":1, "categoryKey":"authors", "categoryi18nKey":"authors"}]
This variable must contain a json array, composed by a list of json objects having the following fields :
- i18nKey : the i18n key to use fort the autocomplete label. The autocomplete label is built like this : [Proposal] [i18n label]. For example, for the author category, an autocomplete proposal could be : Hawkins as author. The "as author" sentence would be retrieved thanks to the "asAuthor" entry in the i18n files located in DATAFARI_HOME/tomcat/webapp/Datafari/js/AjaxFranceLabs/locale/. Of course you will need to create you desired i18n key and associated label in each language file
- serverUrl : if the targeted suggest request handler to request is located and reachable from an other another server than the Datafari main one, you will need to enter its address in this variable
- servlet : the servlet name servlet name associated to the suggest request handler
- maxSuggest : maximum number of category suggestions to display in be displayed within the autocomplete
- categoryKey : the key name of the category corresponding to the suggester request handler. The key name must match to a field name in the CATEGORIES variable of the DATAFARi_HOME/tomcat/conf/entity-autocomplete.properties file (see below for more info)
- categoryi18nKey : i18 key name for the category. Must have a matching entry in the language files located in DATAFARI_HOME/tomcat/webapp/Datafari/js/AjaxFranceLabs/locale/The category
Like described in the part 1above, each suggester must be associated to a category. The categories are defined in the CATEGORIES variable of the DATAFARi_HOME/tomcat/conf/entity-autocomplete.properties file :Code Block CATEGORIES={"authors":{"queryPrefix":"author_search:(", "querySuffix":")", "solrCore":"", "requestHandler":""}}
This variable must contain a json object composed of categories keyname as fields and json objects as values representing the categories specific options :
- queryPrefix : a query prefix to add to each search for this category
- querySuffix : a query suffix to add to each search for this category
- solrCore : the Solr Core to request if it differs from the default one "FileShare"
- requestHandler : the request handler to request to execute request handler that executes the query if it differs from the default one "/select"
These are the pre-configured options of the beta version of the categories features. You can add more options like filter queries, field list etc. but you will need to write some code to handle them in the SearchProxy servlet of Datafari
...