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 Rakesh Sinha <ra...@gmail.com> on 2009/03/02 17:31:13 UTC

Equivalent of TermVector.YES in solr - schema

I am in the process of porting a Lucene code to Solr.

I checked the wiki at - http://wiki.apache.org/solr/SchemaXml  for the
common porting instructions.
But I have a specific query with respect the following line of code,
about creating a field / fieldType in Solr

Lucene:
    return new Field(String, String, Field.Store.NO,
Field.Index.TOKENIZED, TermVector.YES);

Solr:

I created a new field type as -

   <!-- TermVector.YES, Field.Index.Tokenized -->
   <field name="headline" type="string" indexed="true" stored="false"
required="true"/>

My understanding is that - the default type - string does not seem to
be tokenized ( since 2.9 - it is analyzed ).

  <fieldType name="string" class="solr.StrField"
sortMissingLast="true" omitNorms="true"/>

How do I make the field to be TOKENIZED ( since Lucene 2.9, it is
ANALYZED )  with TermVector set to YES.  Thanks.

Re: Equivalent of TermVector.YES in solr - schema

Posted by Grant Ingersoll <gs...@apache.org>.
And, for Term Vectors, add termVectors="true" to the field  
declaration, as in (from solr/example/solr/conf/schema.xml):

<field name="cat" type="text" indexed="true" stored="true"  
multiValued="true" omitNorms="true" termVectors="true" />

And, if you want positions and offsets:
    <field name="features" type="text" indexed="true" stored="true"  
multiValued="true" termVectors="true" termPositions="true"  
termOffsets="true"/>

-Grant

On Mar 2, 2009, at 11:36 AM, Erik Hatcher wrote:

>
> On Mar 2, 2009, at 11:31 AM, Rakesh Sinha wrote:
>> I created a new field type as -
>>
>>  <!-- TermVector.YES, Field.Index.Tokenized -->
>>  <field name="headline" type="string" indexed="true" stored="false"
>> required="true"/>
>>
>> My understanding is that - the default type - string does not seem to
>> be tokenized ( since 2.9 - it is analyzed ).
>>
>> <fieldType name="string" class="solr.StrField"
>> sortMissingLast="true" omitNorms="true"/>
>>
>> How do I make the field to be TOKENIZED ( since Lucene 2.9, it is
>> ANALYZED )  with TermVector set to YES.  Thanks.
>
> Use solr.TextField instead of solr.StrField - and specify the  
> desired analysis configuration for the <fieldType>.
>
> 	Erik
>

--------------------------
Grant Ingersoll
http://www.lucidimagination.com/

Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids)  
using Solr/Lucene:
http://www.lucidimagination.com/search


Re: Equivalent of TermVector.YES in solr - schema

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 2, 2009, at 11:31 AM, Rakesh Sinha wrote:
> I created a new field type as -
>
>   <!-- TermVector.YES, Field.Index.Tokenized -->
>   <field name="headline" type="string" indexed="true" stored="false"
> required="true"/>
>
> My understanding is that - the default type - string does not seem to
> be tokenized ( since 2.9 - it is analyzed ).
>
>  <fieldType name="string" class="solr.StrField"
> sortMissingLast="true" omitNorms="true"/>
>
> How do I make the field to be TOKENIZED ( since Lucene 2.9, it is
> ANALYZED )  with TermVector set to YES.  Thanks.

Use solr.TextField instead of solr.StrField - and specify the desired  
analysis configuration for the <fieldType>.

	Erik