lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil Couture" <ncout...@convera.com>
Subject RE: How to get field contents
Date Fri, 13 Jun 2003 15:04:51 GMT

As far as I know you will have to go throught the index and verify the 
field field (that is not an error) of each term:

			IndexReader reader 	= IndexReader.open("index");
			TermEnum 	te 		= reader.terms(); 
			
			while ( te.next() ) {
				
				Term tt = te.term();
				
				String fieldOfTerm = tt.field();
				
				if ( fieldOfTerm.compareTo( "contents" ) ) {

					do_something_silly()...
				
				} else if ( fieldOfTerm.compareTo( "path" ) ) {

					do_something_silly2()...
				}
			}


-neil




-----Original Message-----
From: Ulrich Mayring [mailto:ulim@denic.de]
Sent: 13 juin, 2003 08:14
To: lucene-user@jakarta.apache.org
Subject: How to get field contents


Hello,

I'd like to build a list with all values from a certain field that occur 
in an index. Looking at the API, there's a method getFieldNames(), but I 
already know the field name, I want to get a list of all the values. 
Also, I can enumerate fields by giving Terms, but a Term means I have to 
have the field name and value.

Can this be done?

Kind regards,

Ulrich



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


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


Mime
View raw message