remove redundat stuff from facet Consts

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1444522 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shai Erera 2013-02-10 10:07:23 +00:00
parent fbfeca05cd
commit a20fbf7130
2 changed files with 3 additions and 30 deletions

View File

@ -1,7 +1,5 @@
package org.apache.lucene.facet.taxonomy.directory;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.StoredFieldVisitor;
import org.apache.lucene.util.BytesRef;
/*
@ -30,30 +28,6 @@ abstract class Consts {
static final String FIELD_PAYLOADS = "$payloads$";
static final String PAYLOAD_PARENT = "p";
static final BytesRef PAYLOAD_PARENT_BYTES_REF = new BytesRef(PAYLOAD_PARENT);
static final char[] PAYLOAD_PARENT_CHARS = PAYLOAD_PARENT.toCharArray();
/**
* The following is a "stored field visitor", an object
* which tells Lucene to extract only a single field
* rather than a whole document.
*/
public static final class LoadFullPathOnly extends StoredFieldVisitor {
private String fullPath;
@Override
public void stringField(FieldInfo fieldInfo, String value) {
fullPath = value;
}
@Override
public Status needsField(FieldInfo fieldInfo) {
return fullPath == null ? Status.YES : Status.STOP;
}
public String getFullPath() {
return fullPath;
}
}
/**
* Delimiter used for creating the full path of a category from the list of

View File

@ -8,12 +8,12 @@ import java.util.logging.Logger;
import org.apache.lucene.facet.collections.LRUHashMap;
import org.apache.lucene.facet.taxonomy.CategoryPath;
import org.apache.lucene.facet.taxonomy.TaxonomyReader;
import org.apache.lucene.facet.taxonomy.directory.Consts.LoadFullPathOnly;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.MultiFields;
import org.apache.lucene.index.StoredDocument;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
@ -320,9 +320,8 @@ public class DirectoryTaxonomyReader extends TaxonomyReader {
}
}
final LoadFullPathOnly loader = new LoadFullPathOnly();
indexReader.document(ordinal, loader);
CategoryPath ret = new CategoryPath(loader.getFullPath(), delimiter);
StoredDocument doc = indexReader.document(ordinal);
CategoryPath ret = new CategoryPath(doc.get(Consts.FULL), delimiter);
synchronized (categoryCache) {
categoryCache.put(catIDInteger, ret);
}