lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Vasilev <>
Subject Suggestion for extending class DocumentStoredFieldVisitor
Date Thu, 01 Nov 2012 10:11:53 GMT
Hy Guys,

I intend to extend DocumentStoredFieldVisitor class like this:

class DocumentStoredNonRepeatableFieldVisitor extends 
DocumentStoredFieldVisitor {

       public Status needsField(FieldInfo fieldInfo) throws IOException {
         return fieldsToAdd == null || fieldsToAdd.contains(
             ? Status.YES
             : fieldsToAdd.size() < doc.getFields().size() ? Status.NO : 

The gain in our application is that we utilize the usage of Status.STOP. 
We have 98 fields currently and in some cases we need loading just 1, 2 
or 3 fields per matching doc and using this we could skip lot of field 
extraction if happen matching fields to be firstly visited.

I do not have time to see how is applied the method doc.add(new 
StoredField(, value)) in Document class - when comes field 
with name already existing in the document does it change the existing 
"value" for that field by concatenating two values, or just adds 
somewhere the new value and concatenation is made later. In latter case 
I think my suggested class could be applied only in cases when we do not 
index fields with the same names to same documents, otherwise with 
checking (fieldsToAdd.size() < doc.getFields().size()) we could stop 
loading fields for that document and in this way miss some repeating 
field. This is why my class is called 

As we use Lucene not like a jar-file but the sources - I will change 
visibility of DocumentStoredFieldVisitor's members "doc" and "fieldsToAdd".
I just want to suggest in the original class DocumentStoredFieldVisitor 
those members's visibility to also be changed so that the class to be 
extended in applications that use jar-files.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message