You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Charles Sanders <cs...@redhat.com> on 2015/01/22 17:14:43 UTC
Suggester Example In Documentation Not Working
Attempting to follow the documentation found here:
https://cwiki.apache.org/confluence/display/solr/Suggester
The example given in the documentation is not working. See below my configuration. I only changed the field names to those in my schema. Can anyone provide an example for this component that actually works?
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">mySuggester</str>
<str name="lookupImpl">FuzzyLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">sugg_allText</str>
<str name="weightField">suggestWeight</str>
<str name="suggestAnalyzerFieldType">string</str>
</lst>
</searchComponent>
<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.build">true</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
<field name="sugg_allText" type="string" indexed="true" multiValued="true" stored="false"/>
<field name="suggestWeight" type="long" indexed="true" stored="true" default="1" />
http://localhost:8888/solr/collection1/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&wt=json&suggest.q=kern
{"responseHeader":{"status":0,"QTime":4},"command":"build","suggest":{"mySuggester":{"kern":{"numFound":0,"suggestions":[]}}}}
Re: Suggester Example In Documentation Not Working
Posted by Chris Hostetter <ho...@fucit.org>.
: However, you will notice on page 228, under the section "Suggester", it
: gives an example of a suggester search component using
: solr.SpellCheckComponet.
...
: So it would appear the solr.SuggestComponent has been around since 4.7,
: but the documentation has not caught up with the changes. Which is the
: source of a little confusion.
Ah -- ok .. yeah, sorry ...
You are correct, there was definitely a lag in having he ref guide updated
to account for the new SuggestComponent -- I didn't realize that.
: Nevertheless, I had hoped to find a simple working example that I could
: use as a starting point to get the solr.SuggestComponent working so that
: I might play around with it and make it do what I want. The suggester
: appears to have many parameters and options, of which, several contain
: little or no explanation.
the params should all be documented in the ref guide *now* -- and you are
correct, that consulting the current ref guide to understand what those
params do will likely be helpful to you -- i guess the main take away of
my comment "#1" was to keep in mind that you may find some params
documented for 5.0 which didn't exist in 4.8. (I'm not sure)
as far as starting with a simple example -- there is absolutely an example
of using the SuggestComponent in the 4.8 sample solrconfig.xml, and if you
index the exampledocs you can see it produce suggestions with a URL like
this...
http://localhost:8983/solr/collection1/suggest?suggest.dictionary=mySuggester&suggest.q=elec
...but my point "#2" is still very important to keep in mind -- that URL
gives good suggestions for "elec" precisely because of what terms exist in
the example docs that were index -- the URL you posted is only going to
give interesting suggestions if there are terms in your index (in the
configured fields) that are relevant. if i try this URL...
http://localhost:8983/solr/collection1/suggest?suggest.dictionary=mySuggester&suggest.q=kern
...i get no suggestions, because none of hte indexed docs have any words
starting with "kern"
in general: posting the examples of URLs you have tried and gotten no good
suggest results from isn't enough for anyone to help give you guidence
unless you also post the specifics of the documents you indexed.
: 2) the behavior of the suggester is very specific to the contents of the
: dictionary built -- the examples on that page apply to the example docs
: included with solr -- hence the techproduct data, and the example queries
: for input like "elec" suggesting "electronics"
:
: no where on that page is an example using the query "kern" -- wether or
: not that input would return a suggestion is going to be entirely dependent
: on wether the dictionary you built contains any similar terms to suggest.
:
: if you can please post more details about your documents -- ideally a full
: set of all the documents in your index (using a small test index of
: course) that may help to understand the results you are getting.
-Hoss
http://www.lucidworks.com/
Re: Suggester Example In Documentation Not Working
Posted by Charles Sanders <cs...@redhat.com>.
Well, I'm running LucidWorks 2.9.1 which contains Solr 4.8.
I initially was working with the Solr documentation:
http://archive.apache.org/dist/lucene/solr/ref-guide/apache-solr-ref-guide-4.8.pdf
However, you will notice on page 228, under the section "Suggester", it gives an example of a suggester search component using solr.SpellCheckComponet.
Then our support rep at LucidWorks said we should use the documentation found here:
https://cwiki.apache.org/confluence/display/solr/Suggester
This documentation is for Solr 5.0, however, you will notice the statement:
"Solr has long had the autosuggest functionality, but Solr 4.7 introduced a new approach based on a dedicated SuggestComponent . "
So it would appear the solr.SuggestComponent has been around since 4.7, but the documentation has not caught up with the changes. Which is the source of a little confusion.
Nevertheless, I had hoped to find a simple working example that I could use as a starting point to get the solr.SuggestComponent working so that I might play around with it and make it do what I want. The suggester appears to have many parameters and options, of which, several contain little or no explanation.
No problem. I will just have to invest a little more time to unravel how the component works and how I can best use it.
Thanks for your reply.
----- Original Message -----
From: "Chris Hostetter" <ho...@fucit.org>
To: solr-user@lucene.apache.org
Sent: Thursday, January 22, 2015 12:50:46 PM
Subject: Re: Suggester Example In Documentation Not Working
1) which version of Solr are you using? (note that the online HTML ref
guide is a DRARFT that applies to 5.0 - you may want to review the
specific released version of the ref guide that applies to your version of
solr: http://archive.apache.org/dist/lucene/solr/ref-guide/
2) the behavior of the suggester is very specific to the contents of the
dictionary built -- the examples on that page apply to the example docs
included with solr -- hence the techproduct data, and the example queries
for input like "elec" suggesting "electronics"
no where on that page is an example using the query "kern" -- wether or
not that input would return a suggestion is going to be entirely dependent
on wether the dictionary you built contains any similar terms to suggest.
if you can please post more details about your documents -- ideally a full
set of all the documents in your index (using a small test index of
course) that may help to understand the results you are getting.
: Date: Thu, 22 Jan 2015 11:14:43 -0500 (EST)
: From: Charles Sanders <cs...@redhat.com>
: Reply-To: solr-user@lucene.apache.org
: To: solr-user@lucene.apache.org
: Subject: Suggester Example In Documentation Not Working
:
: Attempting to follow the documentation found here:
: https://cwiki.apache.org/confluence/display/solr/Suggester
:
: The example given in the documentation is not working. See below my configuration. I only changed the field names to those in my schema. Can anyone provide an example for this component that actually works?
:
: <searchComponent name="suggest" class="solr.SuggestComponent">
: <lst name="suggester">
: <str name="name">mySuggester</str>
: <str name="lookupImpl">FuzzyLookupFactory</str>
: <str name="dictionaryImpl">DocumentDictionaryFactory</str>
: <str name="field">sugg_allText</str>
: <str name="weightField">suggestWeight</str>
: <str name="suggestAnalyzerFieldType">string</str>
: </lst>
: </searchComponent>
:
: <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.build">true</str>
: </lst>
: <arr name="components">
: <str>suggest</str>
: </arr>
: </requestHandler>
:
: <field name="sugg_allText" type="string" indexed="true" multiValued="true" stored="false"/>
: <field name="suggestWeight" type="long" indexed="true" stored="true" default="1" />
:
:
: http://localhost:8888/solr/collection1/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&wt=json&suggest.q=kern
:
: {"responseHeader":{"status":0,"QTime":4},"command":"build","suggest":{"mySuggester":{"kern":{"numFound":0,"suggestions":[]}}}}
:
-Hoss
http://www.lucidworks.com/
Re: Suggester Example In Documentation Not Working
Posted by Chris Hostetter <ho...@fucit.org>.
1) which version of Solr are you using? (note that the online HTML ref
guide is a DRARFT that applies to 5.0 - you may want to review the
specific released version of the ref guide that applies to your version of
solr: http://archive.apache.org/dist/lucene/solr/ref-guide/
2) the behavior of the suggester is very specific to the contents of the
dictionary built -- the examples on that page apply to the example docs
included with solr -- hence the techproduct data, and the example queries
for input like "elec" suggesting "electronics"
no where on that page is an example using the query "kern" -- wether or
not that input would return a suggestion is going to be entirely dependent
on wether the dictionary you built contains any similar terms to suggest.
if you can please post more details about your documents -- ideally a full
set of all the documents in your index (using a small test index of
course) that may help to understand the results you are getting.
: Date: Thu, 22 Jan 2015 11:14:43 -0500 (EST)
: From: Charles Sanders <cs...@redhat.com>
: Reply-To: solr-user@lucene.apache.org
: To: solr-user@lucene.apache.org
: Subject: Suggester Example In Documentation Not Working
:
: Attempting to follow the documentation found here:
: https://cwiki.apache.org/confluence/display/solr/Suggester
:
: The example given in the documentation is not working. See below my configuration. I only changed the field names to those in my schema. Can anyone provide an example for this component that actually works?
:
: <searchComponent name="suggest" class="solr.SuggestComponent">
: <lst name="suggester">
: <str name="name">mySuggester</str>
: <str name="lookupImpl">FuzzyLookupFactory</str>
: <str name="dictionaryImpl">DocumentDictionaryFactory</str>
: <str name="field">sugg_allText</str>
: <str name="weightField">suggestWeight</str>
: <str name="suggestAnalyzerFieldType">string</str>
: </lst>
: </searchComponent>
:
: <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.build">true</str>
: </lst>
: <arr name="components">
: <str>suggest</str>
: </arr>
: </requestHandler>
:
: <field name="sugg_allText" type="string" indexed="true" multiValued="true" stored="false"/>
: <field name="suggestWeight" type="long" indexed="true" stored="true" default="1" />
:
:
: http://localhost:8888/solr/collection1/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&wt=json&suggest.q=kern
:
: {"responseHeader":{"status":0,"QTime":4},"command":"build","suggest":{"mySuggester":{"kern":{"numFound":0,"suggestions":[]}}}}
:
-Hoss
http://www.lucidworks.com/
Re: Suggester Example In Documentation Not Working
Posted by Tomás Fernández Löbbe <to...@gmail.com>.
I see that the docs say that the doc needs to be indexed only, but for
Fuzzy or Analyzed, I think the field needs to be stored. On the other side,
not sure how much sense it makes to use any of those two implementations if
the field type you want to have is "string".
Tomás
On Thu, Jan 22, 2015 at 8:14 AM, Charles Sanders <cs...@redhat.com>
wrote:
> Attempting to follow the documentation found here:
> https://cwiki.apache.org/confluence/display/solr/Suggester
>
> The example given in the documentation is not working. See below my
> configuration. I only changed the field names to those in my schema. Can
> anyone provide an example for this component that actually works?
>
> <searchComponent name="suggest" class="solr.SuggestComponent">
> <lst name="suggester">
> <str name="name">mySuggester</str>
> <str name="lookupImpl">FuzzyLookupFactory</str>
> <str name="dictionaryImpl">DocumentDictionaryFactory</str>
> <str name="field">sugg_allText</str>
> <str name="weightField">suggestWeight</str>
> <str name="suggestAnalyzerFieldType">string</str>
> </lst>
> </searchComponent>
>
> <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.build">true</str>
> </lst>
> <arr name="components">
> <str>suggest</str>
> </arr>
> </requestHandler>
>
> <field name="sugg_allText" type="string" indexed="true" multiValued="true"
> stored="false"/>
> <field name="suggestWeight" type="long" indexed="true" stored="true"
> default="1" />
>
>
>
> http://localhost:8888/solr/collection1/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&wt=json&suggest.q=kern
>
>
> {"responseHeader":{"status":0,"QTime":4},"command":"build","suggest":{"mySuggester":{"kern":{"numFound":0,"suggestions":[]}}}}
>