Mailing List Archive

Retrieving Field info from an index
Greetings-

I am interested in getting information about the available Fields in an
index. Once I get hold of a Field object, it can provide everything I need,
but I'm having trouble getting all of them. I can use Document.fields() to
get the "stored" Fields from an arbitrary document in the index. But... how
can I get other Fields that may have been indexed and not stored?

Thanks much!
-Lex


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: Retrieving Field info from an index [ In reply to ]
Are you sure about this?
Try:
<your Document instance>.getField("<your field name>");
And also:
<your Document instance>.toString();

Can you get/see your fields this way?
I took a look at the source and it looks like Document's add method
treats all Field types the same way, adds them to the same field list.

Otis


--- Lex Lawrence <lex_lawrence@hotmail.com> wrote:
> Greetings-
>
> I am interested in getting information about the available Fields in
> an
> index. Once I get hold of a Field object, it can provide everything
> I need,
> but I'm having trouble getting all of them. I can use
> Document.fields() to
> get the "stored" Fields from an arbitrary document in the index.
> But... how
> can I get other Fields that may have been indexed and not stored?
>
> Thanks much!
> -Lex
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
> --
> To unsubscribe, e-mail:
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-user-help@jakarta.apache.org>
>


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: Retrieving Field info from an index [ In reply to ]
Yes, I tried... and at first thought it was all working. If you create a
document and then access its fields immediately, it gives you everything.
But if you store the document in an index, read it from the index, and then
try to access the fields, you don't get them all. Of the five standard
Field types (Keyword, UnIndexed, Unstored, Text(String,String),
Text(String,Reader)) two are missing (Unstored and Text(String,Reader)).
See the attached test case, "FieldTest.java".

Thanks- Lex



>From: Otis Gospodnetic <otis_gospodnetic@yahoo.com>
>Reply-To: "Lucene Users List" <lucene-user@jakarta.apache.org>
>To: Lucene Users List <lucene-user@jakarta.apache.org>
>Subject: Re: Retrieving Field info from an index
>Date: Wed, 20 Mar 2002 22:19:18 -0800 (PST)
>
>Are you sure about this?
>Try:
><your Document instance>.getField("<your field name>");
>And also:
><your Document instance>.toString();
>
>Can you get/see your fields this way?
>I took a look at the source and it looks like Document's add method
>treats all Field types the same way, adds them to the same field list.
>
>Otis
>
>
>--- Lex Lawrence <lex_lawrence@hotmail.com> wrote:
> > Greetings-
> >
> > I am interested in getting information about the available Fields in
> > an
> > index. Once I get hold of a Field object, it can provide everything
> > I need,
> > but I'm having trouble getting all of them. I can use
> > Document.fields() to
> > get the "stored" Fields from an arbitrary document in the index.
> > But... how
> > can I get other Fields that may have been indexed and not stored?
> >
> > Thanks much!
> > -Lex
> >
> >
> > _________________________________________________________________
> > Chat with friends online, try MSN Messenger: http://messenger.msn.com
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:lucene-user-help@jakarta.apache.org>
> >
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Movies - coverage of the 74th Academy Awards®
>http://movies.yahoo.com/
>
>--
>To unsubscribe, e-mail:
><mailto:lucene-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
><mailto:lucene-user-help@jakarta.apache.org>
>


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
Re: Retrieving Field info from an index [ In reply to ]
Lex Lawrence wrote:
>
> Yes, I tried... and at first thought it was all working. If you create a
> document and then access its fields immediately, it gives you everything.
> But if you store the document in an index, read it from the index, and then
> try to access the fields, you don't get them all. Of the five standard
> Field types (Keyword, UnIndexed, Unstored, Text(String,String),
> Text(String,Reader)) two are missing (Unstored and Text(String,Reader)).
> See the attached test case, "FieldTest.java".
I don't get it. Two missing fields you have mentioned are NOT STORED,
right?
They are just indexed and then forgotten. How do you want to get them?
They ARE NOT in index.

--
Norbert Pabi¶

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: Retrieving Field info from an index [ In reply to ]
You miss my point. The value of an "unstored" Field is not stored in the
index, however it's name most certainly is. That's what I'm interested in.
What I'd like to know if there is a way to get the names of all searchable
Fields in an index.
-Lex


>From: Norbert Pabi¶ <npabis@e-point.pl>
>Reply-To: "Lucene Users List" <lucene-user@jakarta.apache.org>
>To: Lucene Users List <lucene-user@jakarta.apache.org>
>Subject: Re: Retrieving Field info from an index
>Date: Thu, 21 Mar 2002 14:25:27 +0100
>
>Lex Lawrence wrote:
> >
> > Yes, I tried... and at first thought it was all working. If you create
>a
> > document and then access its fields immediately, it gives you
>everything.
> > But if you store the document in an index, read it from the index, and
>then
> > try to access the fields, you don't get them all. Of the five standard
> > Field types (Keyword, UnIndexed, Unstored, Text(String,String),
> > Text(String,Reader)) two are missing (Unstored and Text(String,Reader)).
> > See the attached test case, "FieldTest.java".
>I don't get it. Two missing fields you have mentioned are NOT STORED,
>right?
>They are just indexed and then forgotten. How do you want to get them?
>They ARE NOT in index.
>
>--
>Norbert Pabi¶
>
>--
>To unsubscribe, e-mail:
><mailto:lucene-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
><mailto:lucene-user-help@jakarta.apache.org>
>


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: Retrieving Field info from an index [ In reply to ]
Lex Lawrence wrote:
>
> You miss my point. The value of an "unstored" Field is not stored in the
> index, however it's name most certainly is. That's what I'm interested in.
> What I'd like to know if there is a way to get the names of all searchable
> Fields in an index.
Ok, now I get it, but I don't know that. Lucene source will tell you the
truth.

--
Norbert Pabi¶

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: Retrieving Field info from an index [ In reply to ]
In that case the place to look is org.apache.lucene.store package and
FSDirectory class. Perhaps it treats those 2 fields differently.
I don't have time to look through it now, though.

Otis

--- Lex Lawrence <lex_lawrence@hotmail.com> wrote:
> Yes, I tried... and at first thought it was all working. If you
> create a
> document and then access its fields immediately, it gives you
> everything.
> But if you store the document in an index, read it from the index,
> and then
> try to access the fields, you don't get them all. Of the five
> standard
> Field types (Keyword, UnIndexed, Unstored, Text(String,String),
> Text(String,Reader)) two are missing (Unstored and
> Text(String,Reader)).
> See the attached test case, "FieldTest.java".
>
> Thanks- Lex
>
>
>
> >From: Otis Gospodnetic <otis_gospodnetic@yahoo.com>
> >Reply-To: "Lucene Users List" <lucene-user@jakarta.apache.org>
> >To: Lucene Users List <lucene-user@jakarta.apache.org>
> >Subject: Re: Retrieving Field info from an index
> >Date: Wed, 20 Mar 2002 22:19:18 -0800 (PST)
> >
> >Are you sure about this?
> >Try:
> ><your Document instance>.getField("<your field name>");
> >And also:
> ><your Document instance>.toString();
> >
> >Can you get/see your fields this way?
> >I took a look at the source and it looks like Document's add method
> >treats all Field types the same way, adds them to the same field
> list.
> >
> >Otis
> >
> >
> >--- Lex Lawrence <lex_lawrence@hotmail.com> wrote:
> > > Greetings-
> > >
> > > I am interested in getting information about the available Fields
> in
> > > an
> > > index. Once I get hold of a Field object, it can provide
> everything
> > > I need,
> > > but I'm having trouble getting all of them. I can use
> > > Document.fields() to
> > > get the "stored" Fields from an arbitrary document in the index.
> > > But... how
> > > can I get other Fields that may have been indexed and not stored?
> > >
> > > Thanks much!
> > > -Lex
> > >
> > >
> > > _________________________________________________________________
> > > Chat with friends online, try MSN Messenger:
> http://messenger.msn.com
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <mailto:lucene-user-help@jakarta.apache.org>
> > >
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Yahoo! Movies - coverage of the 74th Academy Awards®
> >http://movies.yahoo.com/
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:lucene-user-unsubscribe@jakarta.apache.org>
> >For additional commands, e-mail:
> ><mailto:lucene-user-help@jakarta.apache.org>
> >
>
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>

> ATTACHMENT part 2 application/octet-stream name=FieldTest.java
> --
> To unsubscribe, e-mail:
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:lucene-user-help@jakarta.apache.org>


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: Retrieving Field info from an index [ In reply to ]
>
>
>>>Lex Lawrence wrote:
>>>
>>>>You miss my point. The value of an "unstored" Field is not stored in the
>>>>index, however it's name most certainly is. That's what I'm interested in.
>>>>What I'd like to know if there is a way to get the names of all searchable
>>>>Fields in an index.
>>>>
>>>Ok, now I get it, but I don't know that. Lucene source will tell you the
>>>truth.
>>>
>I've just checked and I don't think this is available. If it isn't, it
>shouldn't be to hard to add. The information is (at least) in the
>SegmentIndexReader, which has an instance of FieldInfos object. That
>object has size() which will give you the number of fields and it also
>has fieldName(int number) which will give you the name of the field. I
>don't think these are available through the IndexReader interface, so it
>would need to be extended in some way. Maybe just add a method to return
>the field names and then implement it in the SegmentReader and in the
>SegmentsReader (which will combine the fields across all segments).
>
>
>
>
>




--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>