akshayb
akshayb

Reputation: 1239

Solr Term Vector Component returns no terms

I am importing data from MySql.

Here is the field in question looks like in the schema.xml :

<field name="solr_body" type="text_general" indexed="true" stored="true"
  multiValued="true" termVectors="true" termPositions="true" termOffsets="true"/>

And here is the configuration in the solrconfig.xml :

<searchComponent name="tvComponent" class="solr.TermVectorComponent"/>

<requestHandler name="/tvrh" class="solr.SearchHandler" startup="lazy">
  <lst name="defaults">
    <str name="df">text</str>
    <bool name="tv">true</bool>
  </lst>
  <arr name="last-components">
    <str>tvComponent</str>
  </arr>
</requestHandler>

When I submit url http://localhost:8983/solr/select/?qt=tvrh&q=solr_body:[+TO+]&fl=id as per this tutorial, I get usual results, and no terms. I have deleted old index and indexed again after schema change. What is that I am missing. Kindly help.

Edit : Field Type in 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 this example, we will only use synonyms at query time
      <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" 
              ignoreCase="true" expand="false"/>
    -->
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" 
            ignoreCase="true" expand="true"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

Upvotes: 2

Views: 1645

Answers (1)

Rajesh
Rajesh

Reputation: 83

Add the below default param in your "/tvrh" handler

<str name="terms.fl">text</str>

df param is used by "/select" handler by default, not by Terms component. If you are using solr 4.X or higher ,terms component is configured by default.

Upvotes: 1

Related Questions