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 Benjamin Heilbrunn <be...@gmail.com> on 2010/01/11 18:14:04 UTC

Field creation with TokenStream and stored value

Hey out there,

in lucene it's not possible to create a Field based on a TokenStream
AND supply a stored value.

Is there a reason why a Field constructor in the form of
   public Field(String name, TokenStream tokenStream, String storedValue)
does not exist?

I am using trees of TeeSinkTokenFilter's for the creation of many
fields, based on a source string.
That's the reason why I can't use the "standardconstructor"
    public Field(String name, String value, Store store, Index index)


Regards
Benjamin

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


Re: Field creation with TokenStream and stored value

Posted by Andrzej Bialecki <ab...@getopt.org>.
On 2010-01-13 15:29, Benjamin Heilbrunn wrote:
> Thanks!
> Didn't know that it's so easy ;)
>
> 2010/1/13 Uwe Schindler<uw...@thetaphi.de>:
>> Why not simply add the field twice, one time with TokenStream, one time stored only? Internally stored/indexed fields are handled like that.

Actually, you can implement your own Fieldable, and return what you want 
from its methods. You can also use Field constructor that takes the 
stored value, and then use Field.setTokenStream(TokenStream) - it 
doesn't override the stored value.


-- 
Best regards,
Andrzej Bialecki     <><
  ___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com


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


Re: Field creation with TokenStream and stored value

Posted by Benjamin Heilbrunn <be...@gmail.com>.
Thanks!
Didn't know that it's so easy ;)

2010/1/13 Uwe Schindler <uw...@thetaphi.de>:
> Why not simply add the field twice, one time with TokenStream, one time stored only? Internally stored/indexed fields are handled like that.
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>> -----Original Message-----
>> From: Benjamin Heilbrunn [mailto:benhei@gmail.com]
>> Sent: Wednesday, January 13, 2010 2:31 PM
>> To: java-user@lucene.apache.org
>> Subject: Re: Field creation with TokenStream and stored value
>>
>> Sorry for pushing this thing.
>>
>> Would it be possible to add the demanded constructor or would it break
>> anything of lucenes logic?
>>
>>
>> 2010/1/11 Benjamin Heilbrunn <be...@gmail.com>:
>> > Hey out there,
>> >
>> > in lucene it's not possible to create a Field based on a TokenStream
>> > AND supply a stored value.
>> >
>> > Is there a reason why a Field constructor in the form of
>> >   public Field(String name, TokenStream tokenStream, String
>> storedValue)
>> > does not exist?
>> >
>> > I am using trees of TeeSinkTokenFilter's for the creation of many
>> > fields, based on a source string.
>> > That's the reason why I can't use the "standardconstructor"
>> >    public Field(String name, String value, Store store, Index index)
>> >
>> >
>> > Regards
>> > Benjamin
>> >
>>
>> ---------------------------------------------------------------------
>> 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


RE: Field creation with TokenStream and stored value

Posted by Uwe Schindler <uw...@thetaphi.de>.
Why not simply add the field twice, one time with TokenStream, one time stored only? Internally stored/indexed fields are handled like that.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: Benjamin Heilbrunn [mailto:benhei@gmail.com]
> Sent: Wednesday, January 13, 2010 2:31 PM
> To: java-user@lucene.apache.org
> Subject: Re: Field creation with TokenStream and stored value
> 
> Sorry for pushing this thing.
> 
> Would it be possible to add the demanded constructor or would it break
> anything of lucenes logic?
> 
> 
> 2010/1/11 Benjamin Heilbrunn <be...@gmail.com>:
> > Hey out there,
> >
> > in lucene it's not possible to create a Field based on a TokenStream
> > AND supply a stored value.
> >
> > Is there a reason why a Field constructor in the form of
> >   public Field(String name, TokenStream tokenStream, String
> storedValue)
> > does not exist?
> >
> > I am using trees of TeeSinkTokenFilter's for the creation of many
> > fields, based on a source string.
> > That's the reason why I can't use the "standardconstructor"
> >    public Field(String name, String value, Store store, Index index)
> >
> >
> > Regards
> > Benjamin
> >
> 
> ---------------------------------------------------------------------
> 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


Re: Field creation with TokenStream and stored value

Posted by Benjamin Heilbrunn <be...@gmail.com>.
Sorry for pushing this thing.

Would it be possible to add the demanded constructor or would it break
anything of lucenes logic?


2010/1/11 Benjamin Heilbrunn <be...@gmail.com>:
> Hey out there,
>
> in lucene it's not possible to create a Field based on a TokenStream
> AND supply a stored value.
>
> Is there a reason why a Field constructor in the form of
>   public Field(String name, TokenStream tokenStream, String storedValue)
> does not exist?
>
> I am using trees of TeeSinkTokenFilter's for the creation of many
> fields, based on a source string.
> That's the reason why I can't use the "standardconstructor"
>    public Field(String name, String value, Store store, Index index)
>
>
> Regards
> Benjamin
>

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