You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2013/11/14 21:38:45 UTC
svn commit: r1542065 [5/5] - in /lucene/dev/branches/lucene5339/lucene:
benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/
benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/
demo/src/java/org/apache/lucene/demo/facet/ demo/src/test/...
Modified: lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyWriter.java?rev=1542065&r1=1542064&r2=1542065&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyWriter.java (original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyWriter.java Thu Nov 14 20:38:42 2013
@@ -14,7 +14,7 @@ import org.apache.lucene.facet.FacetTest
import org.apache.lucene.facet.index.FacetFields;
import org.apache.lucene.facet.params.FacetIndexingParams;
import org.apache.lucene.facet.search.DrillDownQuery;
-import org.apache.lucene.facet.taxonomy.CategoryPath;
+import org.apache.lucene.facet.taxonomy.FacetLabel;
import org.apache.lucene.facet.taxonomy.TaxonomyReader;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter.MemoryOrdinalMap;
import org.apache.lucene.facet.taxonomy.writercache.TaxonomyWriterCache;
@@ -59,9 +59,9 @@ public class TestDirectoryTaxonomyWriter
@Override
public void close() {}
@Override
- public int get(CategoryPath categoryPath) { return -1; }
+ public int get(FacetLabel categoryPath) { return -1; }
@Override
- public boolean put(CategoryPath categoryPath, int ordinal) { return true; }
+ public boolean put(FacetLabel categoryPath, int ordinal) { return true; }
@Override
public boolean isFull() { return true; }
@Override
@@ -77,7 +77,7 @@ public class TestDirectoryTaxonomyWriter
DirectoryTaxonomyWriter ltw = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, NO_OP_CACHE);
assertFalse(DirectoryReader.indexExists(dir));
ltw.commit(); // first commit, so that an index will be created
- ltw.addCategory(new CategoryPath("a"));
+ ltw.addCategory(new FacetLabel("a"));
IndexReader r = DirectoryReader.open(dir);
assertEquals("No categories should have been committed to the underlying directory", 1, r.numDocs());
@@ -91,8 +91,8 @@ public class TestDirectoryTaxonomyWriter
// Verifies taxonomy commit data
Directory dir = newDirectory();
DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, NO_OP_CACHE);
- taxoWriter.addCategory(new CategoryPath("a"));
- taxoWriter.addCategory(new CategoryPath("b"));
+ taxoWriter.addCategory(new FacetLabel("a"));
+ taxoWriter.addCategory(new FacetLabel("b"));
Map<String, String> userCommitData = new HashMap<String, String>();
userCommitData.put("testing", "1 2 3");
taxoWriter.setCommitData(userCommitData);
@@ -109,7 +109,7 @@ public class TestDirectoryTaxonomyWriter
// in the commit data, otherwise DirTaxoReader.refresh() might not detect
// that the taxonomy index has been recreated.
taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, NO_OP_CACHE);
- taxoWriter.addCategory(new CategoryPath("c")); // add a category so that commit will happen
+ taxoWriter.addCategory(new FacetLabel("c")); // add a category so that commit will happen
taxoWriter.setCommitData(new HashMap<String, String>(){{
put("just", "data");
}});
@@ -133,10 +133,10 @@ public class TestDirectoryTaxonomyWriter
// Verifies that if rollback is called, DTW is closed.
Directory dir = newDirectory();
DirectoryTaxonomyWriter dtw = new DirectoryTaxonomyWriter(dir);
- dtw.addCategory(new CategoryPath("a"));
+ dtw.addCategory(new FacetLabel("a"));
dtw.rollback();
try {
- dtw.addCategory(new CategoryPath("a"));
+ dtw.addCategory(new FacetLabel("a"));
fail("should not have succeeded to add a category following rollback.");
} catch (AlreadyClosedException e) {
// expected
@@ -164,7 +164,7 @@ public class TestDirectoryTaxonomyWriter
DirectoryTaxonomyWriter dtw = new DirectoryTaxonomyWriter(dir);
dtw.close();
try {
- dtw.addCategory(new CategoryPath("a"));
+ dtw.addCategory(new FacetLabel("a"));
fail("should not have succeeded to add a category following close.");
} catch (AlreadyClosedException e) {
// expected
@@ -172,7 +172,7 @@ public class TestDirectoryTaxonomyWriter
dir.close();
}
- private void touchTaxo(DirectoryTaxonomyWriter taxoWriter, CategoryPath cp) throws IOException {
+ private void touchTaxo(DirectoryTaxonomyWriter taxoWriter, FacetLabel cp) throws IOException {
taxoWriter.addCategory(cp);
taxoWriter.setCommitData(new HashMap<String, String>(){{
put("just", "data");
@@ -188,11 +188,11 @@ public class TestDirectoryTaxonomyWriter
Directory dir = newDirectory();
DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, NO_OP_CACHE);
- touchTaxo(taxoWriter, new CategoryPath("a"));
+ touchTaxo(taxoWriter, new FacetLabel("a"));
TaxonomyReader taxoReader = new DirectoryTaxonomyReader(dir);
- touchTaxo(taxoWriter, new CategoryPath("b"));
+ touchTaxo(taxoWriter, new FacetLabel("b"));
TaxonomyReader newtr = TaxonomyReader.openIfChanged(taxoReader);
taxoReader.close();
@@ -202,11 +202,11 @@ public class TestDirectoryTaxonomyWriter
// now recreate the taxonomy, and check that the epoch is preserved after opening DirTW again.
taxoWriter.close();
taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE, NO_OP_CACHE);
- touchTaxo(taxoWriter, new CategoryPath("c"));
+ touchTaxo(taxoWriter, new FacetLabel("c"));
taxoWriter.close();
taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, NO_OP_CACHE);
- touchTaxo(taxoWriter, new CategoryPath("d"));
+ touchTaxo(taxoWriter, new FacetLabel("d"));
taxoWriter.close();
newtr = TaxonomyReader.openIfChanged(taxoReader);
@@ -267,7 +267,7 @@ public class TestDirectoryTaxonomyWriter
while (numCats.decrementAndGet() > 0) {
try {
int value = random.nextInt(range);
- CategoryPath cp = new CategoryPath(Integer.toString(value / 1000), Integer.toString(value / 10000),
+ FacetLabel cp = new FacetLabel(Integer.toString(value / 1000), Integer.toString(value / 10000),
Integer.toString(value / 100000), Integer.toString(value));
int ord = tw.addCategory(cp);
assertTrue("invalid parent for ordinal " + ord + ", category " + cp, tw.getParent(ord) != -1);
@@ -295,11 +295,11 @@ public class TestDirectoryTaxonomyWriter
assertEquals("mismatch number of categories", values.size() + 1, dtr.getSize()); // +1 for root category
int[] parents = dtr.getParallelTaxonomyArrays().parents();
for (String cat : values.keySet()) {
- CategoryPath cp = new CategoryPath(cat, '/');
+ FacetLabel cp = new FacetLabel(cat, '/');
assertTrue("category not found " + cp, dtr.getOrdinal(cp) > 0);
int level = cp.length;
int parentOrd = 0; // for root, parent is always virtual ROOT (ord=0)
- CategoryPath path = CategoryPath.EMPTY;
+ FacetLabel path = FacetLabel.EMPTY;
for (int i = 0; i < level; i++) {
path = cp.subpath(i + 1);
int ord = dtr.getOrdinal(path);
@@ -322,13 +322,13 @@ public class TestDirectoryTaxonomyWriter
public void testReplaceTaxonomy() throws Exception {
Directory input = newDirectory();
DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(input);
- int ordA = taxoWriter.addCategory(new CategoryPath("a"));
+ int ordA = taxoWriter.addCategory(new FacetLabel("a"));
taxoWriter.close();
Directory dir = newDirectory();
taxoWriter = new DirectoryTaxonomyWriter(dir);
- int ordB = taxoWriter.addCategory(new CategoryPath("b"));
- taxoWriter.addCategory(new CategoryPath("c"));
+ int ordB = taxoWriter.addCategory(new FacetLabel("b"));
+ taxoWriter.addCategory(new FacetLabel("c"));
taxoWriter.commit();
long origEpoch = getEpoch(dir);
@@ -339,10 +339,10 @@ public class TestDirectoryTaxonomyWriter
// LUCENE-4633: make sure that category "a" is not added again in any case
taxoWriter.addTaxonomy(input, new MemoryOrdinalMap());
assertEquals("no categories should have been added", 2, taxoWriter.getSize()); // root + 'a'
- assertEquals("category 'a' received new ordinal?", ordA, taxoWriter.addCategory(new CategoryPath("a")));
+ assertEquals("category 'a' received new ordinal?", ordA, taxoWriter.addCategory(new FacetLabel("a")));
// add the same category again -- it should not receive the same ordinal !
- int newOrdB = taxoWriter.addCategory(new CategoryPath("b"));
+ int newOrdB = taxoWriter.addCategory(new FacetLabel("b"));
assertNotSame("new ordinal cannot be the original ordinal", ordB, newOrdB);
assertEquals("ordinal should have been 2 since only one category was added by replaceTaxonomy", 2, newOrdB);
@@ -362,8 +362,8 @@ public class TestDirectoryTaxonomyWriter
// is being added.
Directory dir = newDirectory();
DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE, NO_OP_CACHE);
- int o1 = taxoWriter.addCategory(new CategoryPath("a"));
- int o2 = taxoWriter.addCategory(new CategoryPath("a"));
+ int o1 = taxoWriter.addCategory(new FacetLabel("a"));
+ int o2 = taxoWriter.addCategory(new FacetLabel("a"));
assertTrue("ordinal for same category that is added twice should be the same !", o1 == o2);
taxoWriter.close();
dir.close();
@@ -374,7 +374,7 @@ public class TestDirectoryTaxonomyWriter
// LUCENE-4972: DTW used to create empty commits even if no changes were made
Directory dir = newDirectory();
DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir);
- taxoWriter.addCategory(new CategoryPath("a"));
+ taxoWriter.addCategory(new FacetLabel("a"));
taxoWriter.commit();
long gen1 = SegmentInfos.getLastCommitGeneration(dir);
@@ -391,7 +391,7 @@ public class TestDirectoryTaxonomyWriter
// LUCENE-4972: DTW used to create empty commits even if no changes were made
Directory dir = newDirectory();
DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir);
- taxoWriter.addCategory(new CategoryPath("a"));
+ taxoWriter.addCategory(new FacetLabel("a"));
taxoWriter.commit();
long gen1 = SegmentInfos.getLastCommitGeneration(dir);
@@ -408,7 +408,7 @@ public class TestDirectoryTaxonomyWriter
// LUCENE-4972: DTW used to create empty commits even if no changes were made
Directory dir = newDirectory();
DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir);
- taxoWriter.addCategory(new CategoryPath("a"));
+ taxoWriter.addCategory(new FacetLabel("a"));
taxoWriter.prepareCommit();
taxoWriter.commit();
@@ -432,11 +432,11 @@ public class TestDirectoryTaxonomyWriter
// Add one huge label:
String bigs = null;
int ordinal = -1;
- CategoryPath cp = null;
+ FacetLabel cp = null;
while (true) {
- int len = CategoryPath.MAX_CATEGORY_PATH_LENGTH - 4; // for the dimension and separator
+ int len = FacetLabel.MAX_CATEGORY_PATH_LENGTH - 4; // for the dimension and separator
bigs = _TestUtil.randomSimpleString(random(), len, len);
- cp = new CategoryPath("dim", bigs);
+ cp = new FacetLabel("dim", bigs);
ordinal = taxoWriter.addCategory(cp);
Document doc = new Document();
facetFields.addFields(doc, Collections.singletonList(cp));
@@ -447,9 +447,9 @@ public class TestDirectoryTaxonomyWriter
// Add tiny ones to cause a re-hash
for (int i = 0; i < 3; i++) {
String s = _TestUtil.randomSimpleString(random(), 1, 10);
- taxoWriter.addCategory(new CategoryPath("dim", s));
+ taxoWriter.addCategory(new FacetLabel("dim", s));
Document doc = new Document();
- facetFields.addFields(doc, Collections.singletonList(new CategoryPath("dim", s)));
+ facetFields.addFields(doc, Collections.singletonList(new FacetLabel("dim", s)));
indexWriter.addDocument(doc);
}
@@ -476,11 +476,11 @@ public class TestDirectoryTaxonomyWriter
// build source, large, taxonomy
DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(srcTaxoDir);
- int ord = taxoWriter.addCategory(new CategoryPath("A/1/1/1/1/1/1", '/'));
+ int ord = taxoWriter.addCategory(new FacetLabel("A/1/1/1/1/1/1", '/'));
taxoWriter.close();
taxoWriter = new DirectoryTaxonomyWriter(targetTaxoDir);
- int ordinal = taxoWriter.addCategory(new CategoryPath("B/1", '/'));
+ int ordinal = taxoWriter.addCategory(new FacetLabel("B/1", '/'));
assertEquals(1, taxoWriter.getParent(ordinal)); // call getParent to initialize taxoArrays
taxoWriter.commit();
Modified: lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java?rev=1542065&r1=1542064&r2=1542065&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java (original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java Thu Nov 14 20:38:42 2013
@@ -9,7 +9,7 @@ import java.util.Map;
import java.util.Random;
import org.apache.lucene.facet.FacetTestCase;
-import org.apache.lucene.facet.taxonomy.CategoryPath;
+import org.apache.lucene.facet.taxonomy.FacetLabel;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util._TestUtil;
import org.junit.Test;
@@ -82,7 +82,7 @@ public class TestCompactLabelToOrdinal e
}
int index = random.nextInt(numUniqueValues);
- CategoryPath label = new CategoryPath(uniqueValues[index], '/');
+ FacetLabel label = new FacetLabel(uniqueValues[index], '/');
int ord1 = map.getOrdinal(label);
int ord2 = compact.getOrdinal(label);
@@ -97,7 +97,7 @@ public class TestCompactLabelToOrdinal e
}
for (int i = 0; i < numUniqueValues; i++) {
- CategoryPath label = new CategoryPath(uniqueValues[i], '/');
+ FacetLabel label = new FacetLabel(uniqueValues[i], '/');
int ord1 = map.getOrdinal(label);
int ord2 = compact.getOrdinal(label);
assertEquals(ord1, ord2);
@@ -105,17 +105,17 @@ public class TestCompactLabelToOrdinal e
}
private static class LabelToOrdinalMap extends LabelToOrdinal {
- private Map<CategoryPath, Integer> map = new HashMap<CategoryPath, Integer>();
+ private Map<FacetLabel, Integer> map = new HashMap<FacetLabel, Integer>();
LabelToOrdinalMap() { }
@Override
- public void addLabel(CategoryPath label, int ordinal) {
+ public void addLabel(FacetLabel label, int ordinal) {
map.put(label, ordinal);
}
@Override
- public int getOrdinal(CategoryPath label) {
+ public int getOrdinal(FacetLabel label) {
Integer value = map.get(label);
return (value != null) ? value.intValue() : LabelToOrdinal.INVALID_ORDINAL;
}
Modified: lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/util/OrdinalMappingReaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/util/OrdinalMappingReaderTest.java?rev=1542065&r1=1542064&r2=1542065&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/util/OrdinalMappingReaderTest.java (original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/util/OrdinalMappingReaderTest.java Thu Nov 14 20:38:42 2013
@@ -15,7 +15,7 @@ import org.apache.lucene.facet.search.Co
import org.apache.lucene.facet.search.FacetResult;
import org.apache.lucene.facet.search.FacetResultNode;
import org.apache.lucene.facet.search.FacetsCollector;
-import org.apache.lucene.facet.taxonomy.CategoryPath;
+import org.apache.lucene.facet.taxonomy.FacetLabel;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter.MemoryOrdinalMap;
@@ -81,7 +81,7 @@ public class OrdinalMappingReaderTest ex
DirectoryReader reader1 = DirectoryReader.open(dir);
DirectoryTaxonomyReader taxReader = new DirectoryTaxonomyReader(taxDir);
IndexSearcher searcher = newSearcher(reader1);
- FacetSearchParams fsp = new FacetSearchParams(fip, new CountFacetRequest(new CategoryPath("tag"), NUM_DOCS));
+ FacetSearchParams fsp = new FacetSearchParams(fip, new CountFacetRequest(new FacetLabel("tag"), NUM_DOCS));
FacetsCollector collector = FacetsCollector.create(fsp, reader1, taxReader);
searcher.search(new MatchAllDocsQuery(), collector);
FacetResult result = collector.getFacetResults().get(0);
@@ -107,10 +107,10 @@ public class OrdinalMappingReaderTest ex
DirectoryTaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter(taxDir);
for (int i = 1; i <= NUM_DOCS; i++) {
Document doc = new Document();
- List<CategoryPath> categoryPaths = new ArrayList<CategoryPath>(i + 1);
+ List<FacetLabel> categoryPaths = new ArrayList<FacetLabel>(i + 1);
for (int j = i; j <= NUM_DOCS; j++) {
int facetValue = asc? j: NUM_DOCS - j;
- categoryPaths.add(new CategoryPath("tag", Integer.toString(facetValue)));
+ categoryPaths.add(new FacetLabel("tag", Integer.toString(facetValue)));
}
FacetFields facetFields = new FacetFields(taxonomyWriter, fip);
facetFields.addFields(doc, categoryPaths);
Modified: lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/util/TestFacetsPayloadMigrationReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/util/TestFacetsPayloadMigrationReader.java?rev=1542065&r1=1542064&r2=1542065&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/util/TestFacetsPayloadMigrationReader.java (original)
+++ lucene/dev/branches/lucene5339/lucene/facet/src/test/org/apache/lucene/facet/util/TestFacetsPayloadMigrationReader.java Thu Nov 14 20:38:42 2013
@@ -36,7 +36,7 @@ import org.apache.lucene.facet.search.Fa
import org.apache.lucene.facet.search.FacetResult;
import org.apache.lucene.facet.search.FacetResultNode;
import org.apache.lucene.facet.search.FacetsCollector;
-import org.apache.lucene.facet.taxonomy.CategoryPath;
+import org.apache.lucene.facet.taxonomy.FacetLabel;
import org.apache.lucene.facet.taxonomy.TaxonomyReader;
import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
@@ -159,13 +159,13 @@ public class TestFacetsPayloadMigrationR
for (int i = 0; i < numDocs; i++) {
Document doc = new Document();
int numCategories = random.nextInt(3) + 1;
- ArrayList<CategoryPath> categories = new ArrayList<CategoryPath>(numCategories);
+ ArrayList<FacetLabel> categories = new ArrayList<FacetLabel>(numCategories);
HashSet<String> docDimensions = new HashSet<String>();
while (numCategories-- > 0) {
String dim = DIMENSIONS[random.nextInt(DIMENSIONS.length)];
// we should only increment the expected count by 1 per document
docDimensions.add(dim);
- categories.add(new CategoryPath(dim, Integer.toString(i), Integer.toString(numCategories)));
+ categories.add(new FacetLabel(dim, Integer.toString(i), Integer.toString(numCategories)));
}
facetFields.addFields(doc, categories);
doc.add(new StringField("docid", Integer.toString(i), Store.YES));
@@ -185,7 +185,7 @@ public class TestFacetsPayloadMigrationR
if (random.nextDouble() < 0.2) { // add some documents that will be deleted
doc = new Document();
doc.add(new StringField("del", "key", Store.NO));
- facetFields.addFields(doc, Collections.singletonList(new CategoryPath("dummy")));
+ facetFields.addFields(doc, Collections.singletonList(new FacetLabel("dummy")));
indexWriter.addDocument(doc);
}
}
@@ -264,7 +264,7 @@ public class TestFacetsPayloadMigrationR
// run faceted search and assert expected counts
ArrayList<FacetRequest> requests = new ArrayList<FacetRequest>(expectedCounts.size());
for (String dim : expectedCounts.keySet()) {
- requests.add(new CountFacetRequest(new CategoryPath(dim), 5));
+ requests.add(new CountFacetRequest(new FacetLabel(dim), 5));
}
FacetSearchParams fsp = new FacetSearchParams(fip, requests);
FacetsCollector fc = FacetsCollector.create(fsp, indexReader, taxoReader);
@@ -283,7 +283,7 @@ public class TestFacetsPayloadMigrationR
TaxonomyReader taxoReader, IndexSearcher searcher) throws IOException {
// verify drill-down
for (String dim : expectedCounts.keySet()) {
- CategoryPath drillDownCP = new CategoryPath(dim);
+ FacetLabel drillDownCP = new FacetLabel(dim);
FacetSearchParams fsp = new FacetSearchParams(fip, new CountFacetRequest(drillDownCP, 10));
DrillDownQuery drillDown = new DrillDownQuery(fip, new MatchAllDocsQuery());
drillDown.add(drillDownCP);
@@ -322,7 +322,7 @@ public class TestFacetsPayloadMigrationR
}
foundOrdinals[0] = true; // ROOT ordinals isn't indexed
// mark 'dummy' category ordinal as seen
- int dummyOrdinal = taxoReader.getOrdinal(new CategoryPath("dummy"));
+ int dummyOrdinal = taxoReader.getOrdinal(new FacetLabel("dummy"));
if (dummyOrdinal > 0) {
foundOrdinals[dummyOrdinal] = true;
}
@@ -331,7 +331,7 @@ public class TestFacetsPayloadMigrationR
int numPartitions = (int) Math.ceil(taxoReader.getSize() / (double) partitionSize);
final IntsRef ordinals = new IntsRef(32);
for (String dim : DIMENSIONS) {
- CategoryListParams clp = fip.getCategoryListParams(new CategoryPath(dim));
+ CategoryListParams clp = fip.getCategoryListParams(new FacetLabel(dim));
int partitionOffset = 0;
for (int partition = 0; partition < numPartitions; partition++, partitionOffset += partitionSize) {
final CategoryListIterator cli = clp.createCategoryListIterator(partition);
@@ -368,14 +368,14 @@ public class TestFacetsPayloadMigrationR
Directory taxoDir = newDirectory();
// set custom CLP fields for two dimensions and use the default ($facets) for the other two
- HashMap<CategoryPath,CategoryListParams> params = new HashMap<CategoryPath,CategoryListParams>();
- params.put(new CategoryPath(DIMENSIONS[0]), new CategoryListParams(DIMENSIONS[0]) {
+ HashMap<FacetLabel,CategoryListParams> params = new HashMap<FacetLabel,CategoryListParams>();
+ params.put(new FacetLabel(DIMENSIONS[0]), new CategoryListParams(DIMENSIONS[0]) {
@Override
public OrdinalPolicy getOrdinalPolicy(String dimension) {
return OrdinalPolicy.ALL_PARENTS;
}
});
- params.put(new CategoryPath(DIMENSIONS[1]), new CategoryListParams(DIMENSIONS[1]) {
+ params.put(new FacetLabel(DIMENSIONS[1]), new CategoryListParams(DIMENSIONS[1]) {
@Override
public OrdinalPolicy getOrdinalPolicy(String dimension) {
return OrdinalPolicy.ALL_PARENTS;
Modified: lucene/dev/branches/lucene5339/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyReplicationClientTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyReplicationClientTest.java?rev=1542065&r1=1542064&r2=1542065&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyReplicationClientTest.java (original)
+++ lucene/dev/branches/lucene5339/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyReplicationClientTest.java Thu Nov 14 20:38:42 2013
@@ -32,7 +32,7 @@ import org.apache.lucene.facet.params.Fa
import org.apache.lucene.facet.search.CountFacetRequest;
import org.apache.lucene.facet.search.DrillDownQuery;
import org.apache.lucene.facet.search.FacetsCollector;
-import org.apache.lucene.facet.taxonomy.CategoryPath;
+import org.apache.lucene.facet.taxonomy.FacetLabel;
import org.apache.lucene.facet.taxonomy.TaxonomyReader;
import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
@@ -102,7 +102,7 @@ public class IndexAndTaxonomyReplication
// verify faceted search
int id = Integer.parseInt(indexReader.getIndexCommit().getUserData().get(VERSION_ID), 16);
- CategoryPath cp = new CategoryPath("A", Integer.toString(id, 16));
+ FacetLabel cp = new FacetLabel("A", Integer.toString(id, 16));
IndexSearcher searcher = new IndexSearcher(indexReader);
FacetsCollector fc = FacetsCollector.create(new FacetSearchParams(new CountFacetRequest(cp, 10)), indexReader, taxoReader);
searcher.search(new MatchAllDocsQuery(), fc);
@@ -178,7 +178,7 @@ public class IndexAndTaxonomyReplication
private Document newDocument(TaxonomyWriter taxoWriter, int id) throws IOException {
Document doc = new Document();
FacetFields facetFields = new FacetFields(taxoWriter);
- facetFields.addFields(doc, Collections.singleton(new CategoryPath("A", Integer.toString(id, 16))));
+ facetFields.addFields(doc, Collections.singleton(new FacetLabel("A", Integer.toString(id, 16))));
return doc;
}
Modified: lucene/dev/branches/lucene5339/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyRevisionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5339/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyRevisionTest.java?rev=1542065&r1=1542064&r2=1542065&view=diff
==============================================================================
--- lucene/dev/branches/lucene5339/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyRevisionTest.java (original)
+++ lucene/dev/branches/lucene5339/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyRevisionTest.java Thu Nov 14 20:38:42 2013
@@ -26,7 +26,7 @@ import java.util.Map.Entry;
import org.apache.lucene.document.Document;
import org.apache.lucene.facet.index.FacetFields;
-import org.apache.lucene.facet.taxonomy.CategoryPath;
+import org.apache.lucene.facet.taxonomy.FacetLabel;
import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
import org.apache.lucene.index.IndexFileNames;
import org.apache.lucene.index.IndexWriter;
@@ -44,7 +44,7 @@ public class IndexAndTaxonomyRevisionTes
private Document newDocument(TaxonomyWriter taxoWriter) throws IOException {
Document doc = new Document();
FacetFields ff = new FacetFields(taxoWriter);
- ff.addFields(doc, Collections.singleton(new CategoryPath("A")));
+ ff.addFields(doc, Collections.singleton(new FacetLabel("A")));
return doc;
}