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 Rob Outar <ro...@ideorlando.org> on 2002/11/06 20:46:10 UTC

Several fields with the same name

Hello all,

	I have a relationship where for one key there are many values, basically a
1 to many relationship.  For example with the key = name, value = bob, jim,
etc..

	When a client wants all the values that have been associated with the field
name, how would I get that?  The javadoc for Document.get(String name)
states:

		Returns the string value of the field with the given name if any exist in
this document, or 		null. 	If multiple fields may exist with this name, this
method returns the last added 		such 	added.

	I don't need the last field's value, I need all values associated with that
field.

Any help would be appreciated.

Thanks,

Rob



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Several fields with the same name

Posted by Rob Outar <ro...@ideorlando.org>.
Cool, so it will keep getting the last value excluding the one it just
fetched?

Thanks,

Rob


-----Original Message-----
From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
Sent: Wednesday, November 06, 2002 2:57 PM
To: Lucene Users List
Subject: Re: Several fields with the same name


Looking at the source if looks like you can just call it multiple times
until it returns null.

Otis

--- Rob Outar <ro...@ideorlando.org> wrote:
> Hello all,
>
> 	I have a relationship where for one key there are many values,
> basically a
> 1 to many relationship.  For example with the key = name, value =
> bob, jim,
> etc..
>
> 	When a client wants all the values that have been associated with
> the field
> name, how would I get that?  The javadoc for Document.get(String
> name)
> states:
>
> 		Returns the string value of the field with the given name if any
> exist in
> this document, or 		null. 	If multiple fields may exist with this
> name, this
> method returns the last added 		such 	added.
>
> 	I don't need the last field's value, I need all values associated
> with that
> field.
>
> Any help would be appreciated.
>
> Thanks,
>
> Rob
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Several fields with the same name

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hm, you should look at the source code yourself.  I remember seeing
'return null' there.  You can always add some debug statements to the
Lucene source, recompile/rejar it, and try it, to see what's going on.
Or you can step through your application and Lucene with a debugger to
see what's happening.

Otis

--- Rob Outar <ro...@ideorlando.org> wrote:
> Too long to post but it justs keeps returning the same value over and
> over
> until the exception.
> Thanks,
> 
> Rob
> 
> -----Original Message-----
> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Sent: Wednesday, November 20, 2002 10:34 AM
> To: Lucene Users List
> Subject: RE: Several fields with the same name
> 
> 
> Maybe you can show the actual output of this piece of code.
> What do you get?  Show...
> 
> --- Rob Outar <ro...@ideorlando.org> wrote:
> > Otis,
> >
> > 	Tried this:
> >
> >         f = doc.get(key);
> >
> >         while (f != null ) {
> >             l.add(f);
> >             //get next value for same key
> >             f = doc.get(key);
> >             System.out.println(f);
> >         }
> >
> > I got an outofmemory error after a while so it looks like it will
> > keep
> > returning the same value, and not null;
> >
> > Thanks,
> >
> > Rob
> >
> >
> > -----Original Message-----
> > From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> > Sent: Wednesday, November 06, 2002 2:57 PM
> > To: Lucene Users List
> > Subject: Re: Several fields with the same name
> >
> >
> > Looking at the source if looks like you can just call it multiple
> > times
> > until it returns null.
> >
> > Otis
> >
> > --- Rob Outar <ro...@ideorlando.org> wrote:
> > > Hello all,
> > >
> > > 	I have a relationship where for one key there are many values,
> > > basically a
> > > 1 to many relationship.  For example with the key = name, value =
> > > bob, jim,
> > > etc..
> > >
> > > 	When a client wants all the values that have been associated
> with
> > > the field
> > > name, how would I get that?  The javadoc for Document.get(String
> > > name)
> > > states:
> > >
> > > 		Returns the string value of the field with the given name if
> any
> > > exist in
> > > this document, or 		null. 	If multiple fields may exist with this
> > > name, this
> > > method returns the last added 		such 	added.
> > >
> > > 	I don't need the last field's value, I need all values
> associated
> > > with that
> > > field.
> > >
> > > Any help would be appreciated.
> > >
> > > Thanks,
> > >
> > > Rob
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <ma...@jakarta.apache.org>
> > >
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > HotJobs - Search new jobs daily now
> > http://hotjobs.yahoo.com/
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Several fields with the same name

Posted by Rob Outar <ro...@ideorlando.org>.
Too long to post but it justs keeps returning the same value over and over
until the exception.
Thanks,

Rob

-----Original Message-----
From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
Sent: Wednesday, November 20, 2002 10:34 AM
To: Lucene Users List
Subject: RE: Several fields with the same name


Maybe you can show the actual output of this piece of code.
What do you get?  Show...

--- Rob Outar <ro...@ideorlando.org> wrote:
> Otis,
>
> 	Tried this:
>
>         f = doc.get(key);
>
>         while (f != null ) {
>             l.add(f);
>             //get next value for same key
>             f = doc.get(key);
>             System.out.println(f);
>         }
>
> I got an outofmemory error after a while so it looks like it will
> keep
> returning the same value, and not null;
>
> Thanks,
>
> Rob
>
>
> -----Original Message-----
> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Sent: Wednesday, November 06, 2002 2:57 PM
> To: Lucene Users List
> Subject: Re: Several fields with the same name
>
>
> Looking at the source if looks like you can just call it multiple
> times
> until it returns null.
>
> Otis
>
> --- Rob Outar <ro...@ideorlando.org> wrote:
> > Hello all,
> >
> > 	I have a relationship where for one key there are many values,
> > basically a
> > 1 to many relationship.  For example with the key = name, value =
> > bob, jim,
> > etc..
> >
> > 	When a client wants all the values that have been associated with
> > the field
> > name, how would I get that?  The javadoc for Document.get(String
> > name)
> > states:
> >
> > 		Returns the string value of the field with the given name if any
> > exist in
> > this document, or 		null. 	If multiple fields may exist with this
> > name, this
> > method returns the last added 		such 	added.
> >
> > 	I don't need the last field's value, I need all values associated
> > with that
> > field.
> >
> > Any help would be appreciated.
> >
> > Thanks,
> >
> > Rob
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> HotJobs - Search new jobs daily now
> http://hotjobs.yahoo.com/
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Several fields with the same name

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Maybe you can show the actual output of this piece of code.
What do you get?  Show...

--- Rob Outar <ro...@ideorlando.org> wrote:
> Otis,
> 
> 	Tried this:
> 
>         f = doc.get(key);
> 
>         while (f != null ) {
>             l.add(f);
>             //get next value for same key
>             f = doc.get(key);
>             System.out.println(f);
>         }
> 
> I got an outofmemory error after a while so it looks like it will
> keep
> returning the same value, and not null;
> 
> Thanks,
> 
> Rob
> 
> 
> -----Original Message-----
> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Sent: Wednesday, November 06, 2002 2:57 PM
> To: Lucene Users List
> Subject: Re: Several fields with the same name
> 
> 
> Looking at the source if looks like you can just call it multiple
> times
> until it returns null.
> 
> Otis
> 
> --- Rob Outar <ro...@ideorlando.org> wrote:
> > Hello all,
> >
> > 	I have a relationship where for one key there are many values,
> > basically a
> > 1 to many relationship.  For example with the key = name, value =
> > bob, jim,
> > etc..
> >
> > 	When a client wants all the values that have been associated with
> > the field
> > name, how would I get that?  The javadoc for Document.get(String
> > name)
> > states:
> >
> > 		Returns the string value of the field with the given name if any
> > exist in
> > this document, or 		null. 	If multiple fields may exist with this
> > name, this
> > method returns the last added 		such 	added.
> >
> > 	I don't need the last field's value, I need all values associated
> > with that
> > field.
> >
> > Any help would be appreciated.
> >
> > Thanks,
> >
> > Rob
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> 
> 
> __________________________________________________
> Do you Yahoo!?
> HotJobs - Search new jobs daily now
> http://hotjobs.yahoo.com/
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Several fields with the same name

Posted by Rob Outar <ro...@ideorlando.org>.
Otis,

	Tried this:

        f = doc.get(key);

        while (f != null ) {
            l.add(f);
            //get next value for same key
            f = doc.get(key);
            System.out.println(f);
        }

I got an outofmemory error after a while so it looks like it will keep
returning the same value, and not null;

Thanks,

Rob


-----Original Message-----
From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
Sent: Wednesday, November 06, 2002 2:57 PM
To: Lucene Users List
Subject: Re: Several fields with the same name


Looking at the source if looks like you can just call it multiple times
until it returns null.

Otis

--- Rob Outar <ro...@ideorlando.org> wrote:
> Hello all,
>
> 	I have a relationship where for one key there are many values,
> basically a
> 1 to many relationship.  For example with the key = name, value =
> bob, jim,
> etc..
>
> 	When a client wants all the values that have been associated with
> the field
> name, how would I get that?  The javadoc for Document.get(String
> name)
> states:
>
> 		Returns the string value of the field with the given name if any
> exist in
> this document, or 		null. 	If multiple fields may exist with this
> name, this
> method returns the last added 		such 	added.
>
> 	I don't need the last field's value, I need all values associated
> with that
> field.
>
> Any help would be appreciated.
>
> Thanks,
>
> Rob
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Several fields with the same name

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Looking at the source if looks like you can just call it multiple times
until it returns null.

Otis

--- Rob Outar <ro...@ideorlando.org> wrote:
> Hello all,
> 
> 	I have a relationship where for one key there are many values,
> basically a
> 1 to many relationship.  For example with the key = name, value =
> bob, jim,
> etc..
> 
> 	When a client wants all the values that have been associated with
> the field
> name, how would I get that?  The javadoc for Document.get(String
> name)
> states:
> 
> 		Returns the string value of the field with the given name if any
> exist in
> this document, or 		null. 	If multiple fields may exist with this
> name, this
> method returns the last added 		such 	added.
> 
> 	I don't need the last field's value, I need all values associated
> with that
> field.
> 
> Any help would be appreciated.
> 
> Thanks,
> 
> Rob
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Several fields with the same name

Posted by Doug Cutting <cu...@lucene.com>.
Right.  Use the fields() iterator to scan for multiple Field instances 
with the same name().

Doug

Rob Outar wrote:
> Would the solution be to call Document.fields(), iterate through that enum
> and get my data?
> 
> 
> Thanks,
> 
> Rob
> 
> 
> -----Original Message-----
> From: Rob Outar [mailto:routar@ideorlando.org]
> Sent: Wednesday, November 06, 2002 2:46 PM
> To: Lucene Users List
> Subject: Several fields with the same name
> 
> 
> Hello all,
> 
> 	I have a relationship where for one key there are many values, basically a
> 1 to many relationship.  For example with the key = name, value = bob, jim,
> etc..
> 
> 	When a client wants all the values that have been associated with the field
> name, how would I get that?  The javadoc for Document.get(String name)
> states:
> 
> 		Returns the string value of the field with the given name if any exist in
> this document, or 		null. 	If multiple fields may exist with this name, this
> method returns the last added 		such 	added.
> 
> 	I don't need the last field's value, I need all values associated with that
> field.
> 
> Any help would be appreciated.
> 
> Thanks,
> 
> Rob
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Several fields with the same name

Posted by Otis Gospodnetic <ot...@yahoo.com>.
That sound return the field names (e.g. name, age, gender, etc.)
You want multiple values for the same field.  See my other email.

Otis

--- Rob Outar <ro...@ideorlando.org> wrote:
> Would the solution be to call Document.fields(), iterate through that
> enum
> and get my data?
> 
> 
> Thanks,
> 
> Rob
> 
> 
> -----Original Message-----
> From: Rob Outar [mailto:routar@ideorlando.org]
> Sent: Wednesday, November 06, 2002 2:46 PM
> To: Lucene Users List
> Subject: Several fields with the same name
> 
> 
> Hello all,
> 
> 	I have a relationship where for one key there are many values,
> basically a
> 1 to many relationship.  For example with the key = name, value =
> bob, jim,
> etc..
> 
> 	When a client wants all the values that have been associated with
> the field
> name, how would I get that?  The javadoc for Document.get(String
> name)
> states:
> 
> 		Returns the string value of the field with the given name if any
> exist in
> this document, or 		null. 	If multiple fields may exist with this
> name, this
> method returns the last added 		such 	added.
> 
> 	I don't need the last field's value, I need all values associated
> with that
> field.
> 
> Any help would be appreciated.
> 
> Thanks,
> 
> Rob
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Several fields with the same name

Posted by Rob Outar <ro...@ideorlando.org>.
Would the solution be to call Document.fields(), iterate through that enum
and get my data?


Thanks,

Rob


-----Original Message-----
From: Rob Outar [mailto:routar@ideorlando.org]
Sent: Wednesday, November 06, 2002 2:46 PM
To: Lucene Users List
Subject: Several fields with the same name


Hello all,

	I have a relationship where for one key there are many values, basically a
1 to many relationship.  For example with the key = name, value = bob, jim,
etc..

	When a client wants all the values that have been associated with the field
name, how would I get that?  The javadoc for Document.get(String name)
states:

		Returns the string value of the field with the given name if any exist in
this document, or 		null. 	If multiple fields may exist with this name, this
method returns the last added 		such 	added.

	I don't need the last field's value, I need all values associated with that
field.

Any help would be appreciated.

Thanks,

Rob



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>