lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Spencer, Dave" <d...@lumos.com>
Subject RE: How to get all field names
Date Tue, 12 Nov 2002 18:01:49 GMT
This fragment (from a JSP page..) should dump the
fields for an index in alphabetical order - this
is not precisely what you're asking however -this is all
the fields used in an *index*, not a document, but
anyway maybe this helps:


IndexReader r = IndexReader.open( indexName);
TermEnum te = r.terms();
Set s = new TreeSet();
while ( te.next())
{
	Term t = te.term();
	s.add( t.field());
}
te.close();
r.close();

o.println( "These are all the fields in the index and they can be
searched on...<p>");
Iterator it = s.iterator();
while ( it.hasNext())
{
	o.println( it.next() + "<br>");
}

-----Original Message-----
From: Christoph Kiehl [mailto:kiehl@subshell.com]
Sent: Tuesday, November 12, 2002 1:11 AM
To: lucene-user@jakarta.apache.org
Subject: How to get all field names


Hi,

I was wondering if there is a possibility to get a list of all field
names
that have ever been used to index a document? This way I could filter
out
some special fields, like identity and such, and do a search over the
remaining. That would give me total freedom to choose any document
structure
and have all fields searched. Is this possible? Or do anyone of you have
a
better way achieving that?

Regards
Christoph


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



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


Mime
View raw message