configuring suggester with api

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

configuring suggester with api

Manoj Sonawane
Hello,
I am trying to learn solr config api and having problem creating suggester.
Any pointers will be appriciated

suggester has been setup with

curl -X POST -H 'Content-type:application/json' --data-binary '{
 "add-searchcomponent": {
  "class": "solr.SuggestComponent",
  "name": "titleSuggester",
  "lookupImpl": "FuzzyLookupFactory",
  "dictionaryImpl": "DocumentDictionaryFactory",
  "field": "title_facet",
  "suggestAnalyzerFieldType": "string",
  "buildOnStartup": true
 }
}' http://localhost:8983/solr/jn_core/config


and corresponding handler


echo
echo "setting up suggest handler"
curl -X POST -H 'Content-type:application/json' --data-binary '{
 "update-requesthandler": {
  "name": "/suggest",
  "startup": "lazy",
  "class": "solr.SearchHandler",
  "defaults": {
   "suggest": true,
   "suggest.count": 10
  },
  "components": ["titleSuggester"]
 }
}' http://localhost:8983/solr/jn_core/config


it seems to be configured


http://localhost:8983/solr/jn_core/config/searchComponent?componentName=titleSuggester

{
  "responseHeader":{
    "status":0,
    "QTime":1},
  "config":{"searchComponent":{"titleSuggester":{
        "class":"solr.SuggestComponent",
        "name":"titleSuggester",
        "lookupImpl":"FuzzyLookupFactory",
        "dictionaryImpl":"DocumentDictionaryFactory",
        "field":"title_facet",
        "suggestAnalyzerFieldType":"string",
        "buildOnStartup":true}}}}

but solr returns "No suggester named titleSuggester was configured"
http://localhost:8983/solr/jn_core/suggest?suggest=true&suggest.build=true&suggest.q=elec&suggest.dictionary=titleSuggester

  "responseHeader":{

    "status":400,
    "QTime":0},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"No suggester named titleSuggester was configured",
    "code":400}}
Reply | Threaded
Open this post in threaded view
|

configuring suggester with api

Manoj Sonawane
Hello,
I am trying to learn solr config api and having problem creating suggester.
Any pointers will be appriciated

suggester has been setup with

curl -X POST -H 'Content-type:application/json' --data-binary '{
 "add-searchcomponent": {
  "class": "solr.SuggestComponent",
  "name": "titleSuggester",
  "lookupImpl": "FuzzyLookupFactory",
  "dictionaryImpl": "DocumentDictionaryFactory",
  "field": "title_facet",
  "suggestAnalyzerFieldType": "string",
  "buildOnStartup": true
 }
}' http://localhost:8983/solr/jn_core/config


and corresponding handler


echo
echo "setting up suggest handler"
curl -X POST -H 'Content-type:application/json' --data-binary '{
 "update-requesthandler": {
  "name": "/suggest",
  "startup": "lazy",
  "class": "solr.SearchHandler",
  "defaults": {
   "suggest": true,
   "suggest.count": 10
  },
  "components": ["titleSuggester"]
 }
}' http://localhost:8983/solr/jn_core/config


it seems to be configured


http://localhost:8983/solr/jn_core/config/searchComponent?componentName=titleSuggester

{
  "responseHeader":{
    "status":0,
    "QTime":1},
  "config":{"searchComponent":{"titleSuggester":{
        "class":"solr.SuggestComponent",
        "name":"titleSuggester",
        "lookupImpl":"FuzzyLookupFactory",
        "dictionaryImpl":"DocumentDictionaryFactory",
        "field":"title_facet",
        "suggestAnalyzerFieldType":"string",
        "buildOnStartup":true}}}}

but solr returns "No suggester named titleSuggester was configured"
http://localhost:8983/solr/jn_core/suggest?suggest=true&suggest.build=true&suggest.q=elec&suggest.dictionary=titleSuggester

  "responseHeader":{

    "status":400,
    "QTime":0},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"No suggester named titleSuggester was configured",
    "code":400}}
Reply | Threaded
Open this post in threaded view
|

Re: configuring suggester with api

Audrey Lorberfeld - Audrey.Lorberfeld@ibm.com
In reply to this post by Manoj Sonawane
Hi Manoj,

In the handler, I think you are missing the suggest.dictionary parameter, which should be set to the name of your suggestion component. In this case, I believe it would should be set to "titleSuggester."

In this sample URL from the documentation, they have a suggest.dictionary field, and our suggester (which is working) also has this field:

http://localhost:8983/solr/techproducts/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&suggest.q=c&suggest.cfq=memory

On 3/12/20, 6:33 AM, "Manoj Sonawane" <[hidden email]> wrote:

    Hello,
    I am trying to learn solr config api and having problem creating suggester.
    Any pointers will be appriciated
   
    suggester has been setup with
   
    curl -X POST -H 'Content-type:application/json' --data-binary '{
     "add-searchcomponent": {
      "class": "solr.SuggestComponent",
      "name": "titleSuggester",
      "lookupImpl": "FuzzyLookupFactory",
      "dictionaryImpl": "DocumentDictionaryFactory",
      "field": "title_facet",
      "suggestAnalyzerFieldType": "string",
      "buildOnStartup": true
     }
    }' https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8983_solr_jn-5Fcore_config&d=DwIBaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M&m=oHg3GLNhQJ-kkES97kG61N0D5XFZL3_9tYDftuTVsAw&s=XcEmA461wpbfslh7bRr8nvm3l5uxEjiSwpvoXh6j7yU&e= 
   
   
    and corresponding handler
   
   
    echo
    echo "setting up suggest handler"
    curl -X POST -H 'Content-type:application/json' --data-binary '{
     "update-requesthandler": {
      "name": "/suggest",
      "startup": "lazy",
      "class": "solr.SearchHandler",
      "defaults": {
       "suggest": true,
       "suggest.count": 10
      },
      "components": ["titleSuggester"]
     }
    }' https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8983_solr_jn-5Fcore_config&d=DwIBaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M&m=oHg3GLNhQJ-kkES97kG61N0D5XFZL3_9tYDftuTVsAw&s=XcEmA461wpbfslh7bRr8nvm3l5uxEjiSwpvoXh6j7yU&e= 
   
   
    it seems to be configured
   
   
    https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8983_solr_jn-5Fcore_config_searchComponent-3FcomponentName-3DtitleSuggester&d=DwIBaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M&m=oHg3GLNhQJ-kkES97kG61N0D5XFZL3_9tYDftuTVsAw&s=SUaeM-ToDFByyJFjszLpgEYQdumajHcpV9NJHLQW6bE&e= 
   
    {
      "responseHeader":{
        "status":0,
        "QTime":1},
      "config":{"searchComponent":{"titleSuggester":{
            "class":"solr.SuggestComponent",
            "name":"titleSuggester",
            "lookupImpl":"FuzzyLookupFactory",
            "dictionaryImpl":"DocumentDictionaryFactory",
            "field":"title_facet",
            "suggestAnalyzerFieldType":"string",
            "buildOnStartup":true}}}}
   
    but solr returns "No suggester named titleSuggester was configured"
    https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8983_solr_jn-5Fcore_suggest-3Fsuggest-3Dtrue-26suggest.build-3Dtrue-26suggest.q-3Delec-26suggest.dictionary-3DtitleSuggester&d=DwIBaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M&m=oHg3GLNhQJ-kkES97kG61N0D5XFZL3_9tYDftuTVsAw&s=IPWieKPIiDvS2ezg3JeIIc9xWsgZ7F1VriGtAdab0Q8&e= 
   
      "responseHeader":{
   
        "status":400,
        "QTime":0},
      "error":{
        "metadata":[
          "error-class","org.apache.solr.common.SolrException",
          "root-error-class","org.apache.solr.common.SolrException"],
        "msg":"No suggester named titleSuggester was configured",
        "code":400}}
   

Reply | Threaded
Open this post in threaded view
|

Re: configuring suggester with api

Manoj Sonawane
according to docs at  lucene.apache.org/solr/guide/8_4/suggester.html#
<https://lucene.apache.org/solr/guide/8_4/suggester.html#> that parameter
is optional ( i am supplying it as url param). I guess i have a problem
with JSON payload  to create suggester, but in that case api should error
out.


On Thu, Mar 12, 2020 at 8:57 PM Audrey Lorberfeld -
[hidden email] <[hidden email]> wrote:

> Hi Manoj,
>
> In the handler, I think you are missing the suggest.dictionary parameter,
> which should be set to the name of your suggestion component. In this case,
> I believe it would should be set to "titleSuggester."
>
> In this sample URL from the documentation, they have a suggest.dictionary
> field, and our suggester (which is working) also has this field:
>
>
> http://localhost:8983/solr/techproducts/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&suggest.q=c&suggest.cfq=memory
>
> On 3/12/20, 6:33 AM, "Manoj Sonawane" <[hidden email]> wrote:
>
>     Hello,
>     I am trying to learn solr config api and having problem creating
> suggester.
>     Any pointers will be appriciated
>
>     suggester has been setup with
>
>     curl -X POST -H 'Content-type:application/json' --data-binary '{
>      "add-searchcomponent": {
>       "class": "solr.SuggestComponent",
>       "name": "titleSuggester",
>       "lookupImpl": "FuzzyLookupFactory",
>       "dictionaryImpl": "DocumentDictionaryFactory",
>       "field": "title_facet",
>       "suggestAnalyzerFieldType": "string",
>       "buildOnStartup": true
>      }
>     }'
> https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8983_solr_jn-5Fcore_config&d=DwIBaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M&m=oHg3GLNhQJ-kkES97kG61N0D5XFZL3_9tYDftuTVsAw&s=XcEmA461wpbfslh7bRr8nvm3l5uxEjiSwpvoXh6j7yU&e=
>
>
>     and corresponding handler
>
>
>     echo
>     echo "setting up suggest handler"
>     curl -X POST -H 'Content-type:application/json' --data-binary '{
>      "update-requesthandler": {
>       "name": "/suggest",
>       "startup": "lazy",
>       "class": "solr.SearchHandler",
>       "defaults": {
>        "suggest": true,
>        "suggest.count": 10
>       },
>       "components": ["titleSuggester"]
>      }
>     }'
> https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8983_solr_jn-5Fcore_config&d=DwIBaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M&m=oHg3GLNhQJ-kkES97kG61N0D5XFZL3_9tYDftuTVsAw&s=XcEmA461wpbfslh7bRr8nvm3l5uxEjiSwpvoXh6j7yU&e=
>
>
>     it seems to be configured
>
>
>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8983_solr_jn-5Fcore_config_searchComponent-3FcomponentName-3DtitleSuggester&d=DwIBaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M&m=oHg3GLNhQJ-kkES97kG61N0D5XFZL3_9tYDftuTVsAw&s=SUaeM-ToDFByyJFjszLpgEYQdumajHcpV9NJHLQW6bE&e=
>
>     {
>       "responseHeader":{
>         "status":0,
>         "QTime":1},
>       "config":{"searchComponent":{"titleSuggester":{
>             "class":"solr.SuggestComponent",
>             "name":"titleSuggester",
>             "lookupImpl":"FuzzyLookupFactory",
>             "dictionaryImpl":"DocumentDictionaryFactory",
>             "field":"title_facet",
>             "suggestAnalyzerFieldType":"string",
>             "buildOnStartup":true}}}}
>
>     but solr returns "No suggester named titleSuggester was configured"
>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8983_solr_jn-5Fcore_suggest-3Fsuggest-3Dtrue-26suggest.build-3Dtrue-26suggest.q-3Delec-26suggest.dictionary-3DtitleSuggester&d=DwIBaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M&m=oHg3GLNhQJ-kkES97kG61N0D5XFZL3_9tYDftuTVsAw&s=IPWieKPIiDvS2ezg3JeIIc9xWsgZ7F1VriGtAdab0Q8&e=
>
>       "responseHeader":{
>
>         "status":400,
>         "QTime":0},
>       "error":{
>         "metadata":[
>           "error-class","org.apache.solr.common.SolrException",
>           "root-error-class","org.apache.solr.common.SolrException"],
>         "msg":"No suggester named titleSuggester was configured",
>         "code":400}}
>
>
>