You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Lance Norskog <go...@gmail.com> on 2012/05/14 10:09:58 UTC

Clear/Remove attribute from Token

I would like to remove a payload attribute from a token before it is
indexed. PayloadAttribute lets you set the payload to null.
AttributeSource (parent of all Tokens) does not have a 'remove
Attribute' method. You cannot capture the current attribute set with
'getState()' and then monkey with it (at least Eclipse does not show
me its methods).

If I set the payload to null, when the Token is saved in the index,
will a null payload be saved? Or does the payload get quietly dropped?

-- 
Lance Norskog
goksron@gmail.com

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


Re: Clear/Remove attribute from Token

Posted by Lance Norskog <go...@gmail.com>.
With more hunting, the code for this is in
org.apache.lucene.index.FreqProxTermsWriterPerField.writeProx(int,
int)

The next question is: does a Token need a PositionIncrementAttribute
to be written out? Or can I just tack on a Payload and that is it?
Does it need an Offset also?

On Mon, May 14, 2012 at 1:09 AM, Lance Norskog <go...@gmail.com> wrote:
> I would like to remove a payload attribute from a token before it is
> indexed. PayloadAttribute lets you set the payload to null.
> AttributeSource (parent of all Tokens) does not have a 'remove
> Attribute' method. You cannot capture the current attribute set with
> 'getState()' and then monkey with it (at least Eclipse does not show
> me its methods).
>
> If I set the payload to null, when the Token is saved in the index,
> will a null payload be saved? Or does the payload get quietly dropped?
>
> --
> Lance Norskog
> goksron@gmail.com



-- 
Lance Norskog
goksron@gmail.com

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