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 Nitin Solanki <ni...@gmail.com> on 2015/01/21 10:45:58 UTC

Add user-defined field into suggestions block.

I am working on solr spell checker along with suggester. I am saving
document like this :

{"ngram":"the","count":10}
{"ngram":"the age","count":5}
{"ngram":"the age of","count":3}

where *ngram* is unique key and applied *StandardTokenizer* and
*ShingleFactoryFilter*(1 to 5 size).

So, when I search word "*the*" it gives results along with suggetions like
:

"response":{"numFound":63,"start":0,"maxScore":15.783233,"docs":[
      {
        "count":10,
        "gram":"the",
        "_version_":1489726792958738435}
      },

"suggestion":[{
            "word":"that",
            "freq":1169},
          {
            "word":"they",
            "freq":712}]
       ]

So, suggestion gives *word* and *freq* field according to them. I want
to *add one more field* - *count* into suggestion block where *count*
should the same value which is available into documents. I don't want
to use *freq* field into suggestion block. Instead of that I want
*count* field. How can I do that?