Reputation: 1196
I try to set up a suggester for solr. I have multiple fields with information. This is an example (field: value):
gene: EGFR
cac: abf.4c3C
ccd: frl.dlgfX
subject: EGFR - this change
id: 7390
Now, I'd like solr to be able to get documents already while typing, no matter if the user starts to type the gene name or id or ...
the suggester in solrconfig.xml looks like this (more or less copy/paste from examples):
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
<str name="suggest.dictionary">suggest_muripedia</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
<!-- Suggester component -->
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">suggest_muripedia</str>
<str name="lookupImpl">FuzzyLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">_text_cf</str>
<str name="weightField">subject</str>
<str name="suggestAnalyzerFieldType">string</str>
<str name="buildOnStartup">false</str>
</lst>
</searchComponent>
_text_cf is a field filled by copy rules of the fields mentioned above and defined like this:
{
"name":"_text_cf",
"type":"mytext",
"multiValued":true,
"indexed":true,
"stored":true},
field type mytext
looks like this
{
"name":"mytext",
"class":"solr.TextField",
"positionIncrementGap":"100",
"multiValued":true,
"indexAnalyzer":{
"tokenizer":{
"class":"solr.PatternTokenizerFactory",
"pattern":"-"},
"filters":[{
"class":"solr.TrimFilterFactory"},
{
"class":"solr.StopFilterFactory",
"words":"stopwords.txt",
"ignoreCase":"true"},
{
"class":"solr.LowerCaseFilterFactory"}]},
"queryAnalyzer":{
"tokenizer":{
"class":"solr.PatternTokenizerFactory",
"pattern":"-"},
"filters":[{
"class":"solr.TrimFilterFactory"},
{
"class":"solr.StopFilterFactory",
"words":"stopwords.txt",
"ignoreCase":"true"},
{
"class":"solr.SynonymGraphFilterFactory",
"expand":"true",
"ignoreCase":"true",
"synonyms":"synonyms.txt"},
{
"class":"solr.LowerCaseFilterFactory"}]}},
the queries I've tried did not return any results:
suggest?q=egfr
I have no idea how to troubleshoot and I guess I did not yet fully understand what happens on a suggest-request.
Upvotes: 0
Views: 582
Reputation: 1196
The suggester actually did return results but as the suggestAnalyzerFieldType
has been set to string
the query was case sensitive. changing the field type to my own defined field type mytext
solved this issue.
Upvotes: 1