lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject RE: Field values ...
Date Sat, 22 Mar 2008 23:03:54 GMT

: I want to do something like:
:  
:     List<Info> infoList = new ArrayList<Info> ();
:     foreach (Document doc in LuceneIndex)
:     {
:        String id = doc.get ("Id");
:        String phone = doc.get ("Phone");
:        infoList.add (new Info (id, phone));
:     }

If "Id" and "Phone" are stored values then that code will pretty much work 
as is ... jut change "Document doc in LuceneIndex" to be something that 
does a MtchAllQuery (putting your code in a HitCollector would probably be 
pretty straight forward.

But it won't neccessarily be very efficient, particularly if you've got a 
lot of other stored fields, but a FieldSelector can help make it faster.

if Id and Phone are both indexed fields, and ever doc has only one value 
for each then you can use the FieldCache to get an array for each of them, 
and then just iterate over the arrays in parallel (watch out for deleted 
documents)



-Hoss


---------------------------------------------------------------------
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