-
Notifications
You must be signed in to change notification settings - Fork 256
Blacklight Autocomplete
Thanks to @flyingzumwalt for kicking off this documentation
Blacklight has a new feature in core which allows an application to use autocomplete in the search bar.
This feature is based on code that worked with Solr 4.x, but the feature itself has only been tested with Solr 5.
The Blacklight autocomplete feature does a few things behind the scenes:
- it defines a SuggestionController
- it defines a '/suggest' API endpoint on your application
This feature is configurable via the catalog_controller.rb
in your application
# Configuration for autocomplete suggestor
config.autocomplete_enabled = true
config.autocomplete_path = 'suggest'
The /suggest
API Endpoint will use data that indexed and exposed through /suggest
SearchHandler.
The default Blacklight schema.xml copies dynamic *_t
and *_facet
fields to the suggest
field. *suggest
is setup as a dynamic field of type textSuggest
which contains a basic KeywordTokenizerFactory
. This tokenizer factory, and the fields that are copied into it can be tweaked to modify your suggestions.
The /suggest
request handler uses this factory by the defined search component dictionary mySuggester
.
By default, the copied in fields will used in the autocomplete API.