Details
-
Task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Place holder for documentation that will eventually end up in the Solr Ref guide.
====
The new Suggester Component allows Solr to fully utilize the Lucene suggesters.
The main features are:
- lookup pluggability (TODO: add description):
- AnalyzingInfixLookupFactory
- AnalyzingLookupFactory
- FuzzyLookupFactory
- FreeTextLookupFactory
- FSTLookupFactory
- WFSTLookupFactory
- TSTLookupFactory
- JaspellLookupFactory
- Dictionary pluggability (give users the option to choose the dictionary implementation to use for their suggesters to consume)
- Input from search index
- DocumentDictionaryFactory – user can specify suggestion field along with optional weight and payload fields from their search index.
- DocumentExpressionFactory – same as DocumentDictionaryFactory but allows users to specify arbitrary expression using existing numeric fields.
- HighFrequencyDictionaryFactory – user can specify a suggestion field and specify a threshold to prune out less frequent terms.
- Input from external files
- FileDictionaryFactory – user can specify a file which contains suggest entries, along with optional weights and payloads.
- Input from search index
Config (index time) options:
- name - name of suggester
- sourceLocation - external file location (for file-based suggesters)
- lookupImpl - type of lookup to use [default JaspellLookupFactory]
- dictionaryImpl - type of dictionary to use (lookup input) [default
(sourceLocation == null ? HighFrequencyDictionaryFactory : FileDictionaryFactory)] - storeDir - location to store in-memory data structure in disk
- buildOnCommit - command to build suggester for every commit
- buildOnOptimize - command to build suggester for every optimize
Query time options:
- suggest.dictionary - name of suggester to use (can occur multiple times for batching suggester requests)
- suggest.count - number of suggestions to return
- suggest.q - query to use for lookup
- suggest.build - command to build the suggester
- suggest.reload - command to reload the suggester
- buildAll – command to build all suggesters in the component
- reloadAll – command to reload all suggesters in the component
Example query:
http://localhost:8983/solr/suggest?suggest.dictionary=suggester1&suggest=true&suggest.build=true&suggest.q=elec
Distributed query:
http://localhost:7574/solr/suggest?suggest.dictionary=suggester2&suggest=true&suggest.build=true&suggest.q=elec&shards=localhost:8983/solr,localhost:7574/solr&shards.qt=/suggest
Response Format:
The response format can be either XML or JSON. The typical response structure is as follows:
{ suggest: { suggester_name: { suggest_query: { numFound: .., suggestions: [ {term: .., weight: .., payload: ..}, .. ]} } }
Example Response:
{ responseHeader: { status: 0, QTime: 3 }, suggest: { suggester1: { e: { numFound: 1, suggestions: [ { term: "electronics and computer1", weight: 100, payload: "" } ] } }, suggester2: { e: { numFound: 1, suggestions: [ { term: "electronics and computer1", weight: 10, payload: "" } ] } } } }
Example solrconfig snippet with multiple suggester configuration:
<searchComponent name="suggest" class="solr.SuggestComponent"> <lst name="suggester"> <str name="name">suggester1</str> <str name="lookupImpl">FuzzyLookupFactory</str> <str name="dictionaryImpl">DocumentDictionaryFactory</str> <str name="field">cat</str> <str name="weightField">price</str> <str name="suggestAnalyzerFieldType">string</str> </lst> <lst name="suggester"> <str name="name">suggester2 </str> <str name="dictionaryImpl">DocumentExpressionDictionaryFactory</str> <str name="lookupImpl">FuzzyLookupFactory</str> <str name="field">product_name</str> <str name="weightExpression">((price * 2) + ln(popularity))</str> <str name="sortField">weight</str> <str name="sortField">price</str> <str name="strtoreDir">suggest_fuzzy_doc_expr_dict</str> <str name="suggestAnalyzerFieldType">text</str> </lst> </searchComponent>
Attachments
Issue Links
- is related to
-
SOLR-5378 Suggester Version 2
- Closed