lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Skow" <r...@skow.org>
Subject Re: Adding to the termFreqVector
Date Tue, 31 May 2005 22:02:53 GMT

Adding new terms and re-indexing the document is the desired behavior.

One (non-scalable) solution would be to parse the toString of the
termFreqVector (freq {myTermField: red/2, green/1, blue/1}) and create a
new string representation of the expanded terms:  (red red green blue)

This obviously isn't a good solution.  Finding a way to simply do a
document.addTerm("red"); and then re-indexing would be ideal.



> Is your intent to persist the changed vector somehow or just use it in
> your application for the immediate search?
>
> TermFreqVector is an interface, so if you aren't persisting, I would
> write a wrapper class around the one that is returned by Lucene that has
> add/set methods on it for manipulating the underlying vector and pass
> that around in your application.  Other option, is to get the source and
> modify the TermFreqVector for your needs.
>
> Persistance is a bit harder, but would probably involve manipulating
> the document and then re-indexing it so that it's new vector has the
> updated frequencies by adding some dummy terms onto the document.
>
> Is that what you are looking for?
>
>>>> ryan@skow.org 5/30/2005 12:37:54 PM >>>
>
> How would one go about adding additional terms to a field which is not
>
> stored literally, but instead has a termFreqVector?  For example:
>
> If DocumentA was indexed originally with:
>     myTermField: red green blue
>
> termFreqVector would look like:
>    freq {myTermField: red/1, green/1, blue/1}
>
> Now, I'd like to add some more terms (red, yellow) and desire the
> termFreqVector to look like this:
>    freq {myTermField: red/2, green/1, blue/1, yellow/1}
>
> It would seem like there would be a covenant way of accomplishing this,
>
> but I must be missing something.
>
> Any advice would be greatly appreciated!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message