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 Saurabh Agarwal <sr...@gmail.com> on 2010/05/13 21:44:29 UTC
Storing a field as byte[[]
Hi,
I am new to lucene. the constructors in Feild show that I can give the value
as byte[] I wanted to ask if I store a integer as a byte array the how it
will ve searched during search say file size!!!
because if I use text format the range search will be poor say fs of 10 12
20 30 50 100 101 102 will be organised as
10
100
101
102
12
20
30
50
so range search of size between 10 and 20 will be relatively poor if I store
values like the order given
Thanks and regards
Saurabh Agarwal
Re: Storing a field as byte[[]
Posted by Saurabh Agarwal <sr...@gmail.com>.
Thanks Uwe
Saurabh Agarwal
On Fri, May 14, 2010 at 11:09 AM, Uwe Schindler <uw...@thetaphi.de> wrote:
> There is a class NumericField in the same package.
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>
> > -----Original Message-----
> > From: Saurabh Agarwal [mailto:srbh.grwl@gmail.com]
> > Sent: Friday, May 14, 2010 4:55 AM
> > To: java-user@lucene.apache.org
> > Subject: Re: Storing a field as byte[[]
> >
> > hi Ian
> >
> > but when I see lucene-
> > 3.0.0/src/java/org/apache/lucene/document/Field.java
> > all the constructors either take a String ad value or a byte [] array
> > as a
> > value. Can u guide me that how to use NumericField or am I missing
> > something?
> >
> > Thanks
> > Saurabh Agarwal
> >
> >
> > On Fri, May 14, 2010 at 1:33 AM, Ian Lea <ia...@gmail.com> wrote:
> >
> > > You can store byte arrays, but you can't search on them. For
> > integers
> > > you can either pad them out with leading zeros or use NumericField.
> > If
> > > you use NumericField you'll need to use NumericRangeQuery as well.
> > >
> > > --
> > > Ian.
> > >
> > >
> > > On Thu, May 13, 2010 at 8:44 PM, Saurabh Agarwal
> > <sr...@gmail.com>
> > > wrote:
> > > > Hi,
> > > > I am new to lucene. the constructors in Feild show that I can give
> > the
> > > value
> > > > as byte[] I wanted to ask if I store a integer as a byte array the
> > how it
> > > > will ve searched during search say file size!!!
> > > >
> > > > because if I use text format the range search will be poor say fs
> > of 10
> > > 12
> > > > 20 30 50 100 101 102 will be organised as
> > > > 10
> > > > 100
> > > > 101
> > > > 102
> > > > 12
> > > > 20
> > > > 30
> > > > 50
> > > >
> > > > so range search of size between 10 and 20 will be relatively poor
> > if I
> > > store
> > > > values like the order given
> > > >
> > > > Thanks and regards
> > > > Saurabh Agarwal
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > 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: Storing a field as byte[[]
Posted by Uwe Schindler <uw...@thetaphi.de>.
There is a class NumericField in the same package.
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de
> -----Original Message-----
> From: Saurabh Agarwal [mailto:srbh.grwl@gmail.com]
> Sent: Friday, May 14, 2010 4:55 AM
> To: java-user@lucene.apache.org
> Subject: Re: Storing a field as byte[[]
>
> hi Ian
>
> but when I see lucene-
> 3.0.0/src/java/org/apache/lucene/document/Field.java
> all the constructors either take a String ad value or a byte [] array
> as a
> value. Can u guide me that how to use NumericField or am I missing
> something?
>
> Thanks
> Saurabh Agarwal
>
>
> On Fri, May 14, 2010 at 1:33 AM, Ian Lea <ia...@gmail.com> wrote:
>
> > You can store byte arrays, but you can't search on them. For
> integers
> > you can either pad them out with leading zeros or use NumericField.
> If
> > you use NumericField you'll need to use NumericRangeQuery as well.
> >
> > --
> > Ian.
> >
> >
> > On Thu, May 13, 2010 at 8:44 PM, Saurabh Agarwal
> <sr...@gmail.com>
> > wrote:
> > > Hi,
> > > I am new to lucene. the constructors in Feild show that I can give
> the
> > value
> > > as byte[] I wanted to ask if I store a integer as a byte array the
> how it
> > > will ve searched during search say file size!!!
> > >
> > > because if I use text format the range search will be poor say fs
> of 10
> > 12
> > > 20 30 50 100 101 102 will be organised as
> > > 10
> > > 100
> > > 101
> > > 102
> > > 12
> > > 20
> > > 30
> > > 50
> > >
> > > so range search of size between 10 and 20 will be relatively poor
> if I
> > store
> > > values like the order given
> > >
> > > Thanks and regards
> > > Saurabh Agarwal
> > >
> >
> > ---------------------------------------------------------------------
> > 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: Storing a field as byte[[]
Posted by Saurabh Agarwal <sr...@gmail.com>.
hi Ian
but when I see lucene-3.0.0/src/java/org/apache/lucene/document/Field.java
all the constructors either take a String ad value or a byte [] array as a
value. Can u guide me that how to use NumericField or am I missing
something?
Thanks
Saurabh Agarwal
On Fri, May 14, 2010 at 1:33 AM, Ian Lea <ia...@gmail.com> wrote:
> You can store byte arrays, but you can't search on them. For integers
> you can either pad them out with leading zeros or use NumericField. If
> you use NumericField you'll need to use NumericRangeQuery as well.
>
> --
> Ian.
>
>
> On Thu, May 13, 2010 at 8:44 PM, Saurabh Agarwal <sr...@gmail.com>
> wrote:
> > Hi,
> > I am new to lucene. the constructors in Feild show that I can give the
> value
> > as byte[] I wanted to ask if I store a integer as a byte array the how it
> > will ve searched during search say file size!!!
> >
> > because if I use text format the range search will be poor say fs of 10
> 12
> > 20 30 50 100 101 102 will be organised as
> > 10
> > 100
> > 101
> > 102
> > 12
> > 20
> > 30
> > 50
> >
> > so range search of size between 10 and 20 will be relatively poor if I
> store
> > values like the order given
> >
> > Thanks and regards
> > Saurabh Agarwal
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Re: Storing a field as byte[[]
Posted by Ian Lea <ia...@gmail.com>.
You can store byte arrays, but you can't search on them. For integers
you can either pad them out with leading zeros or use NumericField. If
you use NumericField you'll need to use NumericRangeQuery as well.
--
Ian.
On Thu, May 13, 2010 at 8:44 PM, Saurabh Agarwal <sr...@gmail.com> wrote:
> Hi,
> I am new to lucene. the constructors in Feild show that I can give the value
> as byte[] I wanted to ask if I store a integer as a byte array the how it
> will ve searched during search say file size!!!
>
> because if I use text format the range search will be poor say fs of 10 12
> 20 30 50 100 101 102 will be organised as
> 10
> 100
> 101
> 102
> 12
> 20
> 30
> 50
>
> so range search of size between 10 and 20 will be relatively poor if I store
> values like the order given
>
> Thanks and regards
> Saurabh Agarwal
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org