lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karl wettin <ka...@snigel.net>
Subject Re: searching in more than fields on document
Date Tue, 06 Jun 2006 10:02:27 GMT
On Tue, 2006-06-06 at 10:47 +0100, digby wrote:
> I was wondering this exact question, but MultiFieldQueryParser still 
> requires you to specify the field names. In my application I don't know 
> the field names (they're automatically generated from beans using 
> BeanUtils.getProperties()), so I've resorted to concatenating all the 
> fields into a single "content" field which I then search on (I also have 
> the individual fields added too).
> 
> Would this be the correct approach for what I'm trying to do, or is 
> there another "AllFieldsQueryParser" I could use?

If you don't know the field names you'll have to use the IndexReader to
iterate available fields:

http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html

getFieldNames(IndexReader.FieldOption fldOption) 
          Get a list of unique field names that exist in this index and
have the specified field option information.


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


Mime
View raw message