facet - Solr : Counting how many times a word appears in a a line not in a document -


example :i fetching data db , rows looks below id age text


1 10 great good 2 12 good 

what want result count of in id

q:good facet.query:good facet.field: id 

result should below

"facet_counts": {      "facet_queries": {      "text:good": 4 }, "facet_fields": {    "id": [       "1",2,       "2",2,    } } 

what

"facet_fields": {     "id": [        "1",1,        "2",1,     } } 

looks removing duplicate values in row ?

can please help

schema.xml


<fieldtype name="text_general" class="solr.textfield" positionincrementgap="100">   <analyzer type="index">     <tokenizer class="solr.standardtokenizerfactory"/>     <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" />     <!-- in example, use synonyms @ query time     <filter class="solr.synonymfilterfactory" synonyms="synonyms.txt" ignorecase="true" expand="false"/>     -->     <filter class="solr.lowercasefilterfactory"/>     <filter class="solr.porterstemfilterfactory"/>   </analyzer> 

it not removing duplicate values.

you getting facets field id . according query, there 1 document each id=1 , id=2 , thats why results "facet_fields":

{     "id":          { "1",1,            "2",1,         }  } 

your question title , have explained in question bit confusing.

is line single document in solr index? 1 10 great good 2 12 good

or these 2 different documents: document 1

{   id:1   age:10   text:great good     } 

document 2

{   id:2   age:12   text:thanks good } 

there no in built way in solr return results expecting. i.e. return count of word inside each document. closest can term vector component: https://cwiki.apache.org/confluence/display/solr/the+term+vector+component


Comments