SetBasedFieldSelectorpublic class SetBasedFieldSelector extends Object implements FieldSelectorDeclare what fields to load normally and what fields to load lazily |
Fields Summary |
---|
private Set | fieldsToLoad | private Set | lazyFieldsToLoad |
Constructors Summary |
---|
public SetBasedFieldSelector(Set fieldsToLoad, Set lazyFieldsToLoad)Pass in the Set of {@link Field} names to load and the Set of {@link Field} names to load lazily. If both are null, the
Document will not have any {@link Field} on it.
this.fieldsToLoad = fieldsToLoad;
this.lazyFieldsToLoad = lazyFieldsToLoad;
|
Methods Summary |
---|
public org.apache.lucene.document.FieldSelectorResult | accept(java.lang.String fieldName)Indicate whether to load the field with the given name or not. If the {@link Field#name()} is not in either of the
initializing Sets, then {@link org.apache.lucene.document.FieldSelectorResult#NO_LOAD} is returned. If a Field name
is in both fieldsToLoad and lazyFieldsToLoad , lazy has precedence.
FieldSelectorResult result = FieldSelectorResult.NO_LOAD;
if (fieldsToLoad.contains(fieldName) == true){
result = FieldSelectorResult.LOAD;
}
if (lazyFieldsToLoad.contains(fieldName) == true){
result = FieldSelectorResult.LAZY_LOAD;
}
return result;
|
|