Saturday, February 25, 2006

Lucene Term Vectors

Using term vectors, we can provide choices to the users of our application that match the current choice. For instance, on a site that I am developing, I plan to use term vectors to offer my site users the ability to see "related articles" when they are reading an article.

Term Vectors are specified by setting an instance of Field.TermVector to true when calling a method similar to the following:

Field(String, String, Field.Store, Field.Index, Field.TermVector)



If you don't want to store the term vector

Field(name, value, Field.Store.YES, Field.Index.TOKENIZED)


If you do want to store the term vector

Field(name, value, Field.Store.YES, Field.Index.TOKENIZED, storeTermVector)



Term vector can also be stored for "Unstored" fields:
Don't store term vector, but tokenize and index the field, without storing the field

Field(name, value, Field.Store.NO, Field.Index.TOKENIZED)


If you do want to store term vector, tokenize and index the field, but not storing it in the index:

Field(name, value, Field.Store.NO, Field.Index.TOKENIZED, storeTermVector)




To find out whether term vector is stored for a field, we can use: isTermVectorStored

public final boolean isTermVectorStored()
IndexReader.getTermFreqVector(int,String)
IndexReader.getTermFreqVector(int, String)


Note from the manual about the above:
These methods do not provide access to the original content of the field, only to terms used to index it. If the original content must be preserved, use the stored attribute instead.


Other related functions:

isStoreOffsetWithTermVector


isStorePositionWithTermVector

5 Comments:

At 8:30 PM, Blogger raypang20 said...

does the term vector has anything to do with eof error which im facing now whn i index a sql database...

need help urgently

thx

raypang20@yahoo.com

 
At 10:08 PM, Blogger Popular shoes said...

It is appropriate time to make a few plans for the longer term and it is time to be happy. I've learn this publish and if I could I desire to suggest you some attention-grabbing things or advice.
More tags:
wow gold buy cheap

wow buy gold cheap

wow buy cheap gold

wow gold fast cheap

cheap wow gold fast


 
At 12:41 AM, Blogger Unknown said...

Using term vectors, we can provide choices to the users of our application that match the current choice. For instance, on a site that I am developing, I plan to use term vectors to offer my site users the ability to see "related articles" when they are reading an article.guild wars 2 gold
buy guild wars 2 gold
cheap guild wars 2 gold
cheapest guild wars 2 gold
guild wars 2 gold for sale

 
At 12:45 AM, Blogger Unknown said...

does the term vector has anything to do with eof error which im facing now whn i index a sql databaseswtor gold
buy swtor gold
cheap swtor gold
tor credits
buy tor credits
cheap tor credits

 
At 12:14 AM, Blogger emily said...

Thanks. I always enjoy reading your posts - they are always humorous and intelligent.I am a china tour lover,You can learn more: China travel packages | Asia tour packages | China city tour packages

 

Post a Comment

<< Home

eXTReMe Tracker