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 Michael Ryan <mr...@moreover.com> on 2011/06/17 05:46:34 UTC

omitTermFreqAndPositions in a TextField fieldType

Is it possible to use omitTermFreqAndPositions="true" in a <fieldType> declaration that uses class="solr.TextField"? I've tried doing this and it does not seem to work (i.e., the prx file size does not change). Using it in a <field> declaration does work, but I'd rather set it in the <fieldType> so I don't have to repeat it multiple times in my schema.

>From my schema.xml file:
<fieldType name="foobar" class="solr.TextField" sortMissingLast="true"
    omitNorms="true" omitTermFreqAndPositions="true" indexed="true"
    stored="true" positionIncrementGap="100">
  <analyzer>
    <tokenizer class="solr.KeywordTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

In the TextField class I found that it disables OMIT_TF_POSITIONS, which I'm assuming is the cause of my problem:
if (schema.getVersion()> 1.1f) properties &= ~OMIT_TF_POSITIONS;

Does it even make sense to use omitTermFreqAndPositions for a TextField, or am I perhaps doing something I shouldn't be?

-Michael

Re: omitTermFreqAndPositions in a TextField fieldType

Posted by Ahmet Arslan <io...@yahoo.com>.
> Does it even make sense to use omitTermFreqAndPositions for
> a TextField, or am I perhaps doing something I shouldn't
> be?

Yes it makes sense to disable tf, positions and norms if you don't need them. For example, I have this category_name field where its definition includes:

omitNorms="true" omitTermFreqAndPositions="true"

I don't need PhraseQuery, lenght normalization, index time boost, etc.
I only display three (rows=3) category names for a given query.