From 52ab4cb9a8dbeb8cefc5fba5150dbc34ef1b7638 Mon Sep 17 00:00:00 2001 From: Shai Erera Date: Thu, 3 Nov 2011 06:26:22 +0000 Subject: [PATCH] LUCENE-3552: rename LuceneTaxonomyReader/Writer to DirectoryTaxonomyReader/Writer git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1196963 13f79535-47bb-0310-9956-ffa450edef68 --- .../byTask/tasks/CreateTaxonomyIndexTask.java | 4 +- .../byTask/tasks/OpenTaxonomyIndexTask.java | 5 +- .../byTask/tasks/OpenTaxonomyReaderTask.java | 4 +- modules/facet/docs/userguide.html | 6 +- .../lucene/facet/example/ExampleUtils.java | 2 +- .../example/adaptive/AdaptiveSearcher.java | 4 +- .../association/AssociationIndexer.java | 4 +- .../association/AssociationSearcher.java | 6 +- .../example/merge/TaxonomyMergeUtils.java | 24 ++--- .../facet/example/multiCL/MultiCLIndexer.java | 6 +- .../example/multiCL/MultiCLSearcher.java | 4 +- .../facet/example/simple/SimpleIndexer.java | 4 +- .../facet/example/simple/SimpleMain.java | 6 +- .../index/FacetsPayloadProcessorProvider.java | 2 +- .../lucene/facet/taxonomy/TaxonomyWriter.java | 33 +------ .../{lucene => directory}/Consts.java | 2 +- .../DirectoryTaxonomyReader.java} | 28 +++--- .../DirectoryTaxonomyWriter.java} | 83 ++++++++++------- .../{lucene => directory}/ParentArray.java | 2 +- .../{lucene => directory}/package.html | 0 .../writercache/TaxonomyWriterCache.java | 4 +- .../writercache/lru/NameIntCacheLRU.java | 2 +- .../apache/lucene/facet/FacetTestBase.java | 8 +- .../apache/lucene/facet/FacetTestUtils.java | 8 +- .../enhancements/TwoEnhancementsTest.java | 6 +- .../CustomAssociationPropertyTest.java | 8 +- .../FacetsPayloadProcessorProviderTest.java | 8 +- .../categorypolicy/OrdinalPolicyTest.java | 4 +- .../index/categorypolicy/PathPolicyTest.java | 4 +- .../streaming/CategoryParentsStreamTest.java | 10 +- .../streaming/CategoryTokenizerTest.java | 6 +- .../lucene/facet/search/DrillDownTest.java | 14 ++- .../search/TestMultipleCategoryLists.java | 24 ++--- .../TestTopKInEachNodeResultHandler.java | 8 +- .../search/TestTotalFacetCountsCache.java | 14 +-- .../AssociationsFacetRequestTest.java | 12 +-- .../facet/search/params/FacetRequestTest.java | 8 +- .../search/params/FacetSearchParamsTest.java | 12 +-- .../params/MultiIteratorsPerCLParamsTest.java | 8 +- .../facet/taxonomy/TestTaxonomyCombined.java | 92 +++++++++---------- .../TestAddTaxonomies.java | 40 ++++---- .../TestDirectoryTaxonomyReader.java} | 18 ++-- .../TestDirectoryTaxonomyWriter.java} | 10 +- .../{lucene => directory}/TestIndexClose.java | 21 ++--- 44 files changed, 286 insertions(+), 292 deletions(-) rename modules/facet/src/java/org/apache/lucene/facet/taxonomy/{lucene => directory}/Consts.java (97%) rename modules/facet/src/java/org/apache/lucene/facet/taxonomy/{lucene/LuceneTaxonomyReader.java => directory/DirectoryTaxonomyReader.java} (95%) rename modules/facet/src/java/org/apache/lucene/facet/taxonomy/{lucene/LuceneTaxonomyWriter.java => directory/DirectoryTaxonomyWriter.java} (95%) rename modules/facet/src/java/org/apache/lucene/facet/taxonomy/{lucene => directory}/ParentArray.java (99%) rename modules/facet/src/java/org/apache/lucene/facet/taxonomy/{lucene => directory}/package.html (100%) rename modules/facet/src/test/org/apache/lucene/facet/taxonomy/{lucene => directory}/TestAddTaxonomies.java (85%) rename modules/facet/src/test/org/apache/lucene/facet/taxonomy/{lucene/TestLuceneTaxonomyReader.java => directory/TestDirectoryTaxonomyReader.java} (74%) rename modules/facet/src/test/org/apache/lucene/facet/taxonomy/{lucene/TestLuceneTaxonomyWriter.java => directory/TestDirectoryTaxonomyWriter.java} (88%) rename modules/facet/src/test/org/apache/lucene/facet/taxonomy/{lucene => directory}/TestIndexClose.java (88%) diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateTaxonomyIndexTask.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateTaxonomyIndexTask.java index 3752f498182..0c469f68d77 100644 --- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateTaxonomyIndexTask.java +++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateTaxonomyIndexTask.java @@ -18,7 +18,7 @@ package org.apache.lucene.benchmark.byTask.tasks; */ import org.apache.lucene.benchmark.byTask.PerfRunData; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import java.io.IOException; @@ -37,7 +37,7 @@ public class CreateTaxonomyIndexTask extends PerfTask { @Override public int doLogic() throws IOException { PerfRunData runData = getRunData(); - runData.setTaxonomyWriter(new LuceneTaxonomyWriter(runData.getTaxonomyDir(), OpenMode.CREATE)); + runData.setTaxonomyWriter(new DirectoryTaxonomyWriter(runData.getTaxonomyDir(), OpenMode.CREATE)); return 1; } diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenTaxonomyIndexTask.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenTaxonomyIndexTask.java index 613578dd63a..b6aacd70c83 100644 --- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenTaxonomyIndexTask.java +++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenTaxonomyIndexTask.java @@ -18,7 +18,8 @@ package org.apache.lucene.benchmark.byTask.tasks; */ import org.apache.lucene.benchmark.byTask.PerfRunData; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; + import java.io.IOException; @@ -35,7 +36,7 @@ public class OpenTaxonomyIndexTask extends PerfTask { @Override public int doLogic() throws IOException { PerfRunData runData = getRunData(); - runData.setTaxonomyWriter(new LuceneTaxonomyWriter(runData.getTaxonomyDir())); + runData.setTaxonomyWriter(new DirectoryTaxonomyWriter(runData.getTaxonomyDir())); return 1; } diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenTaxonomyReaderTask.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenTaxonomyReaderTask.java index 03268f06064..73246759463 100644 --- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenTaxonomyReaderTask.java +++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenTaxonomyReaderTask.java @@ -20,7 +20,7 @@ package org.apache.lucene.benchmark.byTask.tasks; import java.io.IOException; import org.apache.lucene.benchmark.byTask.PerfRunData; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; /** * Open a taxonomy index reader. @@ -35,7 +35,7 @@ public class OpenTaxonomyReaderTask extends PerfTask { @Override public int doLogic() throws IOException { PerfRunData runData = getRunData(); - LuceneTaxonomyReader taxoReader = new LuceneTaxonomyReader(runData.getTaxonomyDir()); + DirectoryTaxonomyReader taxoReader = new DirectoryTaxonomyReader(runData.getTaxonomyDir()); runData.setTaxonomyReader(taxoReader); // We transfer reference to the run data taxoReader.decRef(); diff --git a/modules/facet/docs/userguide.html b/modules/facet/docs/userguide.html index 5c97a990cc7..684d498f0dc 100644 --- a/modules/facet/docs/userguide.html +++ b/modules/facet/docs/userguide.html @@ -264,7 +264,7 @@ Following is a code snippet for indexing categories. The complete example can be found in package org.apache.lucene.facet.example.simple.SimpleIndexer.
 IndexWriter writer = ...
-TaxonomyWriter taxo = new LuceneTaxonomyWriter(taxoDir, OpenMode.CREATE);
+TaxonomyWriter taxo = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE);
 ...
 Document doc = new Document();
 doc.add(new Field("title", titleText, Store.YES, Index.ANALYZED));
@@ -366,7 +366,7 @@ found under org.apache.lucene.facet.example.simple.Searcher:
 
 IndexReader indexReader = IndexReader.open(indexDir);
 Searcher searcher = new IndexSearcher(indexReader);
-TaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir);
+TaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir);
 ...
 Query q = new TermQuery(new Term(SimpleUtils.TEXT, "white"));
 TopScoreDocCollector tdc = TopScoreDocCollector.create(10, true);
@@ -781,4 +781,4 @@ the only thing that can happen is that new categories are added. Since search th
 are added in the middle of a search, there is no reason to keep around the old object, and the new one suffices.
 
 
-
\ No newline at end of file
+
diff --git a/modules/facet/src/examples/org/apache/lucene/facet/example/ExampleUtils.java b/modules/facet/src/examples/org/apache/lucene/facet/example/ExampleUtils.java
index 2e12c987656..f5e211bd3b9 100644
--- a/modules/facet/src/examples/org/apache/lucene/facet/example/ExampleUtils.java
+++ b/modules/facet/src/examples/org/apache/lucene/facet/example/ExampleUtils.java
@@ -27,7 +27,7 @@ public class ExampleUtils {
   public static final boolean VERBOSE = Boolean.getBoolean("tests.verbose");
 
   /** The Lucene {@link Version} used by the example code. */
-  public static final Version EXAMPLE_VER = Version.LUCENE_31;
+  public static final Version EXAMPLE_VER = Version.LUCENE_40;
   
   public static void log(Object msg) {
     if (VERBOSE) {
diff --git a/modules/facet/src/examples/org/apache/lucene/facet/example/adaptive/AdaptiveSearcher.java b/modules/facet/src/examples/org/apache/lucene/facet/example/adaptive/AdaptiveSearcher.java
index 93326e52dc0..6cf8083ee4b 100644
--- a/modules/facet/src/examples/org/apache/lucene/facet/example/adaptive/AdaptiveSearcher.java
+++ b/modules/facet/src/examples/org/apache/lucene/facet/example/adaptive/AdaptiveSearcher.java
@@ -20,7 +20,7 @@ import org.apache.lucene.facet.search.params.FacetSearchParams;
 import org.apache.lucene.facet.search.results.FacetResult;
 import org.apache.lucene.facet.taxonomy.CategoryPath;
 import org.apache.lucene.facet.taxonomy.TaxonomyReader;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -55,7 +55,7 @@ public class AdaptiveSearcher {
    */
   public static List searchWithFacets (Directory indexDir, Directory taxoDir) throws Exception {
     // prepare index reader and taxonomy.
-    TaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir);
+    TaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir);
     IndexReader indexReader = IndexReader.open(indexDir);
     
     // prepare searcher to search against
diff --git a/modules/facet/src/examples/org/apache/lucene/facet/example/association/AssociationIndexer.java b/modules/facet/src/examples/org/apache/lucene/facet/example/association/AssociationIndexer.java
index 13828370dc3..6c91040028d 100644
--- a/modules/facet/src/examples/org/apache/lucene/facet/example/association/AssociationIndexer.java
+++ b/modules/facet/src/examples/org/apache/lucene/facet/example/association/AssociationIndexer.java
@@ -16,7 +16,7 @@ import org.apache.lucene.facet.index.CategoryContainer;
 import org.apache.lucene.facet.index.CategoryDocumentBuilder;
 import org.apache.lucene.facet.taxonomy.CategoryPath;
 import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -60,7 +60,7 @@ public class AssociationIndexer {
     IndexWriter iw = new IndexWriter(indexDir, new IndexWriterConfig(ExampleUtils.EXAMPLE_VER, SimpleUtils.analyzer));
 
     // create and open a taxonomy writer
-    TaxonomyWriter taxo = new LuceneTaxonomyWriter(taxoDir, OpenMode.CREATE);
+    TaxonomyWriter taxo = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE);
 
     // loop over sample documents
     int nDocsAdded = 0;
diff --git a/modules/facet/src/examples/org/apache/lucene/facet/example/association/AssociationSearcher.java b/modules/facet/src/examples/org/apache/lucene/facet/example/association/AssociationSearcher.java
index 08a8e715d64..f429c4363b7 100644
--- a/modules/facet/src/examples/org/apache/lucene/facet/example/association/AssociationSearcher.java
+++ b/modules/facet/src/examples/org/apache/lucene/facet/example/association/AssociationSearcher.java
@@ -11,7 +11,7 @@ import org.apache.lucene.facet.search.params.association.AssociationIntSumFacetR
 import org.apache.lucene.facet.search.results.FacetResult;
 import org.apache.lucene.facet.taxonomy.CategoryPath;
 import org.apache.lucene.facet.taxonomy.TaxonomyReader;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -43,7 +43,7 @@ public class AssociationSearcher {
       Directory taxoDir) throws Exception {
     // prepare index reader 
     IndexReader indexReader = IndexReader.open(indexDir);
-    TaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir);
+    TaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir);
     
     AssociationIntSumFacetRequest facetRequest = new AssociationIntSumFacetRequest(
         new CategoryPath("tags"), 10);
@@ -63,7 +63,7 @@ public class AssociationSearcher {
       Directory taxoDir) throws Exception {
     // prepare index reader 
     IndexReader indexReader = IndexReader.open(indexDir);
-    TaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir);
+    TaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir);
     
     AssociationFloatSumFacetRequest facetRequest = new AssociationFloatSumFacetRequest(
         new CategoryPath("genre"), 10);
diff --git a/modules/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java b/modules/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java
index f310f9ff175..40dfac53dfd 100644
--- a/modules/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java
+++ b/modules/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java
@@ -11,10 +11,10 @@ import org.apache.lucene.store.Directory;
 import org.apache.lucene.facet.example.ExampleUtils;
 import org.apache.lucene.facet.index.FacetsPayloadProcessorProvider;
 import org.apache.lucene.facet.index.params.DefaultFacetIndexingParams;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter.DiskOrdinalMap;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter.MemoryOrdinalMap;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter.OrdinalMap;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter.DiskOrdinalMap;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter.MemoryOrdinalMap;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter.OrdinalMap;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -40,19 +40,19 @@ public class TaxonomyMergeUtils {
 
   /**
    * Merges the given taxonomy and index directories. Note that this method
-   * opens {@link LuceneTaxonomyWriter} and {@link IndexWriter} on the
+   * opens {@link DirectoryTaxonomyWriter} and {@link IndexWriter} on the
    * respective destination indexes. Therefore if you have a writer open on any
    * of them, it should be closed, or you should use
-   * {@link #merge(Directory, Directory, IndexWriter, LuceneTaxonomyWriter)}
+   * {@link #merge(Directory, Directory, IndexWriter, DirectoryTaxonomyWriter)}
    * instead.
    * 
-   * @see #merge(Directory, Directory, IndexWriter, LuceneTaxonomyWriter)
+   * @see #merge(Directory, Directory, IndexWriter, DirectoryTaxonomyWriter)
    */
   public static void merge(Directory srcIndexDir, Directory srcTaxDir,
                             Directory destIndexDir, Directory destTaxDir) throws IOException {
     IndexWriter destIndexWriter = new IndexWriter(destIndexDir,
         new IndexWriterConfig(ExampleUtils.EXAMPLE_VER, null));
-    LuceneTaxonomyWriter destTaxWriter = new LuceneTaxonomyWriter(destTaxDir);
+    DirectoryTaxonomyWriter destTaxWriter = new DirectoryTaxonomyWriter(destTaxDir);
     merge(srcIndexDir, srcTaxDir, new MemoryOrdinalMap(), destIndexWriter, destTaxWriter);
     destTaxWriter.close();
     destIndexWriter.close();
@@ -62,14 +62,14 @@ public class TaxonomyMergeUtils {
    * Merges the given taxonomy and index directories and commits the changes to
    * the given writers. This method uses {@link MemoryOrdinalMap} to store the
    * mapped ordinals. If you cannot afford the memory, you can use
-   * {@link #merge(Directory, Directory, LuceneTaxonomyWriter.OrdinalMap, IndexWriter, LuceneTaxonomyWriter)}
+   * {@link #merge(Directory, Directory, DirectoryTaxonomyWriter.OrdinalMap, IndexWriter, DirectoryTaxonomyWriter)}
    * by passing {@link DiskOrdinalMap}.
    * 
-   * @see #merge(Directory, Directory, LuceneTaxonomyWriter.OrdinalMap, IndexWriter, LuceneTaxonomyWriter)
+   * @see #merge(Directory, Directory, DirectoryTaxonomyWriter.OrdinalMap, IndexWriter, DirectoryTaxonomyWriter)
    */
   public static void merge(Directory srcIndexDir, Directory srcTaxDir,
                             IndexWriter destIndexWriter, 
-                            LuceneTaxonomyWriter destTaxWriter) throws IOException {
+                            DirectoryTaxonomyWriter destTaxWriter) throws IOException {
     merge(srcIndexDir, srcTaxDir, new MemoryOrdinalMap(), destIndexWriter, destTaxWriter);
   }
   
@@ -79,7 +79,7 @@ public class TaxonomyMergeUtils {
    */
   public static void merge(Directory srcIndexDir, Directory srcTaxDir,
                             OrdinalMap map, IndexWriter destIndexWriter,
-                            LuceneTaxonomyWriter destTaxWriter) throws IOException {
+                            DirectoryTaxonomyWriter destTaxWriter) throws IOException {
     // merge the taxonomies
     destTaxWriter.addTaxonomies(new Directory[] { srcTaxDir }, new OrdinalMap[] { map });
 
diff --git a/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLIndexer.java b/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLIndexer.java
index a17454eeff1..9778386ce41 100644
--- a/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLIndexer.java
+++ b/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLIndexer.java
@@ -21,7 +21,7 @@ import org.apache.lucene.facet.index.params.CategoryListParams;
 import org.apache.lucene.facet.index.params.FacetIndexingParams;
 import org.apache.lucene.facet.index.params.PerDimensionIndexingParams;
 import org.apache.lucene.facet.taxonomy.CategoryPath;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -140,7 +140,7 @@ public class MultiCLIndexer {
     IndexWriter iw = new IndexWriter(indexDir, new IndexWriterConfig(
         ExampleUtils.EXAMPLE_VER, SimpleUtils.analyzer).setOpenMode(OpenMode.CREATE));
     // create and open a taxonomy writer
-    LuceneTaxonomyWriter taxo = new LuceneTaxonomyWriter(taxoDir, OpenMode.CREATE);
+    DirectoryTaxonomyWriter taxo = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE);
     index(iw, taxo, iParams, docTitles, docTexts, cPaths);
   }
   
@@ -153,7 +153,7 @@ public class MultiCLIndexer {
    *             on error (no detailed exception handling here for sample
    *             simplicity
    */
-  public static void index(IndexWriter iw, LuceneTaxonomyWriter taxo,
+  public static void index(IndexWriter iw, DirectoryTaxonomyWriter taxo,
       FacetIndexingParams iParams, String[] docTitles,
       String[] docTexts, CategoryPath[][] cPaths) throws Exception {
 
diff --git a/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLSearcher.java b/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLSearcher.java
index 8be59ca3791..650b420e70f 100644
--- a/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLSearcher.java
+++ b/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLSearcher.java
@@ -20,7 +20,7 @@ import org.apache.lucene.facet.search.params.FacetSearchParams;
 import org.apache.lucene.facet.search.results.FacetResult;
 import org.apache.lucene.facet.taxonomy.CategoryPath;
 import org.apache.lucene.facet.taxonomy.TaxonomyReader;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -64,7 +64,7 @@ public class MultiCLSearcher {
     
     // prepare index reader and taxonomy.
     IndexReader indexReader = IndexReader.open(indexDir);
-    TaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir);
+    TaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir);
     
     // Get results
     List results = searchWithFacets(indexReader, taxo, iParams);
diff --git a/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleIndexer.java b/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleIndexer.java
index 644ce356c5b..cef9ff7f298 100644
--- a/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleIndexer.java
+++ b/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleIndexer.java
@@ -15,7 +15,7 @@ import org.apache.lucene.facet.example.ExampleUtils;
 import org.apache.lucene.facet.index.CategoryDocumentBuilder;
 import org.apache.lucene.facet.taxonomy.CategoryPath;
 import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -53,7 +53,7 @@ public class SimpleIndexer {
     IndexWriter iw = new IndexWriter(indexDir, new IndexWriterConfig(ExampleUtils.EXAMPLE_VER, SimpleUtils.analyzer));
 
     // create and open a taxonomy writer
-    TaxonomyWriter taxo = new LuceneTaxonomyWriter(taxoDir, OpenMode.CREATE);
+    TaxonomyWriter taxo = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE);
 
     // loop over  sample documents 
     int nDocsAdded = 0;
diff --git a/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleMain.java b/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleMain.java
index da3a5d33706..f3449ce2609 100644
--- a/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleMain.java
+++ b/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleMain.java
@@ -10,7 +10,7 @@ import org.apache.lucene.facet.example.ExampleResult;
 import org.apache.lucene.facet.example.ExampleUtils;
 import org.apache.lucene.facet.search.results.FacetResult;
 import org.apache.lucene.facet.taxonomy.TaxonomyReader;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -56,7 +56,7 @@ public class SimpleMain {
     SimpleIndexer.index(indexDir, taxoDir);
 
     // open readers
-    TaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir);
+    TaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir);
     IndexReader indexReader = IndexReader.open(indexDir, true);
 
     ExampleUtils.log("search the sample documents...");
@@ -81,7 +81,7 @@ public class SimpleMain {
     SimpleIndexer.index(indexDir, taxoDir);
 
     // open readers
-    TaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir);
+    TaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir);
     IndexReader indexReader = IndexReader.open(indexDir, true);
 
     ExampleUtils.log("search the sample documents...");
diff --git a/modules/facet/src/java/org/apache/lucene/facet/index/FacetsPayloadProcessorProvider.java b/modules/facet/src/java/org/apache/lucene/facet/index/FacetsPayloadProcessorProvider.java
index 881ebf0048f..4fab2a8e302 100644
--- a/modules/facet/src/java/org/apache/lucene/facet/index/FacetsPayloadProcessorProvider.java
+++ b/modules/facet/src/java/org/apache/lucene/facet/index/FacetsPayloadProcessorProvider.java
@@ -13,7 +13,7 @@ import org.apache.lucene.store.Directory;
 
 import org.apache.lucene.facet.index.params.CategoryListParams;
 import org.apache.lucene.facet.index.params.FacetIndexingParams;
-import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter.OrdinalMap;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter.OrdinalMap;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.encoding.IntDecoder;
 import org.apache.lucene.util.encoding.IntEncoder;
diff --git a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyWriter.java b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyWriter.java
index 6cc9ca862dd..fb3df37198e 100644
--- a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyWriter.java
+++ b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyWriter.java
@@ -2,9 +2,8 @@ package org.apache.lucene.facet.taxonomy;
 
 import java.io.Closeable;
 import java.io.IOException;
-import java.util.Map;
 
-import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.util.TwoPhaseCommit;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -52,7 +51,7 @@ import org.apache.lucene.index.IndexWriter;
  * 
  * @lucene.experimental
  */
-public interface TaxonomyWriter extends Closeable {
+public interface TaxonomyWriter extends Closeable, TwoPhaseCommit {
   
   /**
    * addCategory() adds a category with a given path name to the taxonomy,
@@ -66,32 +65,6 @@ public interface TaxonomyWriter extends Closeable {
    */ 
   public int addCategory(CategoryPath categoryPath) throws IOException;
   
-  /**
-   * Calling commit() ensures that all the categories written so far are
-   * visible to a reader that is opened (or reopened) after that call.
-   * When the index is closed(), commit() is also implicitly done. 
-   */
-  public void commit() throws IOException;
-
-  /**
-   * Like commit(), but also store properties with the index. These properties
-   * are retrievable by {@link TaxonomyReader#getCommitUserData}.
-   * See {@link IndexWriter#commit(Map)}. 
-   */
-  public void commit(Map commitUserData) throws IOException;
-  
-  /**
-   * prepare most of the work needed for a two-phase commit.
-   * See {@link IndexWriter#prepareCommit}.
-   */
-  public void prepareCommit() throws IOException;
-  
-  /**
-   * Like above, and also prepares to store user data with the index.
-   * See {@link IndexWriter#prepareCommit(Map)}
-   */
-  public void prepareCommit(Map commitUserData) throws IOException;
-  
   /**
    * getParent() returns the ordinal of the parent category of the category
    * with the given ordinal.
@@ -108,8 +81,8 @@ public interface TaxonomyWriter extends Closeable {
    * ordinal), an ArrayIndexOutOfBoundsException is thrown. However, it is
    * expected that getParent will only be called for ordinals which are
    * already known to be in the taxonomy.
-   * 

* TODO (Facet): instead of a getParent(ordinal) method, consider having a + *

* getCategory(categorypath, prefixlen) which is similar to addCategory * except it doesn't add new categories; This method can be used to get * the ordinals of all prefixes of the given category, and it can use diff --git a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/Consts.java b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java similarity index 97% rename from modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/Consts.java rename to modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java index 2a91eb372ac..5ce13344577 100644 --- a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/Consts.java +++ b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/Consts.java @@ -1,4 +1,4 @@ -package org.apache.lucene.facet.taxonomy.lucene; +package org.apache.lucene.facet.taxonomy.directory; import java.io.IOException; diff --git a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyReader.java b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java similarity index 95% rename from modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyReader.java rename to modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java index fa304486bac..b5c21846bbb 100644 --- a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyReader.java +++ b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java @@ -1,4 +1,4 @@ -package org.apache.lucene.facet.taxonomy.lucene; +package org.apache.lucene.facet.taxonomy.directory; import java.io.IOException; import java.util.Iterator; @@ -11,7 +11,7 @@ import java.util.logging.Logger; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.Consts.LoadFullPathOnly; +import org.apache.lucene.facet.taxonomy.directory.Consts.LoadFullPathOnly; import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.IndexReader; @@ -40,24 +40,21 @@ import org.apache.lucene.util.collections.LRUHashMap; * limitations under the License. */ -/** - * LuceneTaxonomyReader is a {@link TaxonomyReader} which retrieves stored - * taxonomy information from a separate Lucene index. By using a Lucene index, - * rather than some specialized file format, we get for "free" its correctness - * (especially regarding concurrency), and the ability to save it on any - * implementation of Directory (and not just the file system). +/** + * A {@link TaxonomyReader} which retrieves stored taxonomy information from a + * {@link Directory}. *

* Reading from the on-disk index on every method call is too slow, so this - * implementation employs caching: Some methods cache recent requests and - * their results, while other methods prefetch all the data into memory - * and then provide answers directly from in-memory tables. See the - * documentation of individual methods for comments on their performance. + * implementation employs caching: Some methods cache recent requests and their + * results, while other methods prefetch all the data into memory and then + * provide answers directly from in-memory tables. See the documentation of + * individual methods for comments on their performance. * * @lucene.experimental */ -public class LuceneTaxonomyReader implements TaxonomyReader { +public class DirectoryTaxonomyReader implements TaxonomyReader { - private static final Logger logger = Logger.getLogger(LuceneTaxonomyReader.class.getName()); + private static final Logger logger = Logger.getLogger(DirectoryTaxonomyReader.class.getName()); private IndexReader indexReader; @@ -111,8 +108,7 @@ public class LuceneTaxonomyReader implements TaxonomyReader { * @throws CorruptIndexException if the Taxonomy is corrupted. * @throws IOException if another error occurred. */ - public LuceneTaxonomyReader(Directory directory) - throws CorruptIndexException, IOException { + public DirectoryTaxonomyReader(Directory directory) throws IOException { this.indexReader = openIndexReader(directory); // These are the default cache sizes; they can be configured after diff --git a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyWriter.java b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java similarity index 95% rename from modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyWriter.java rename to modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java index 3a7c89957b5..24b92d3d837 100644 --- a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyWriter.java +++ b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java @@ -1,4 +1,4 @@ -package org.apache.lucene.facet.taxonomy.lucene; +package org.apache.lucene.facet.taxonomy.directory; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -64,29 +64,24 @@ import org.apache.lucene.facet.taxonomy.writercache.lru.LruTaxonomyWriterCache; */ /** - * {@link TaxonomyWriter} which uses a Lucene index to store the taxonomy + * {@link TaxonomyWriter} which uses a {@link Directory} to store the taxonomy * information on disk, and keeps an additional in-memory cache of some or all * categories. - *

- * By using a Lucene index to store the information on disk, rather than some - * specialized file format, we get for "free" Lucene's correctness (especially - * regarding multi-process concurrency), and the ability to write to any - * implementation of Directory (and not just the file system). - *

- * In addition to the permanently-stored Lucene index, efficiency dictates that - * we also keep an in-memory cache of recently seen or all - * categories, so that we do not need to go back to disk for every category - * addition to see which ordinal this category already has, if any. A - * {@link TaxonomyWriterCache} object determines the specific caching algorithm - * used. + *

+ * In addition to the permanently-stored information in the {@link Directory}, + * efficiency dictates that we also keep an in-memory cache of recently + * seen or all categories, so that we do not need to go back to disk + * for every category addition to see which ordinal this category already has, + * if any. A {@link TaxonomyWriterCache} object determines the specific caching + * algorithm used. *

* This class offers some hooks for extending classes to control the - * {@link IndexWriter} instance that is used. See {@link #openLuceneIndex} and - * {@link #closeLuceneIndex()} . + * {@link IndexWriter} instance that is used. See {@link #openIndexWriter} and + * {@link #closeIndexWriter()} . * * @lucene.experimental */ -public class LuceneTaxonomyWriter implements TaxonomyWriter { +public class DirectoryTaxonomyWriter implements TaxonomyWriter { protected IndexWriter indexWriter; private int nextID; @@ -171,12 +166,12 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { * @throws IOException * if another error occurred. */ - public LuceneTaxonomyWriter(Directory directory, OpenMode openMode, + public DirectoryTaxonomyWriter(Directory directory, OpenMode openMode, TaxonomyWriterCache cache) throws CorruptIndexException, LockObtainFailedException, IOException { - openLuceneIndex(directory, openMode); + openIndexWriter(directory, openMode); reader = null; FieldType ft = new FieldType(TextField.TYPE_UNSTORED); @@ -218,18 +213,20 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { * etc.
* NOTE: the instance this method returns will be closed upon calling * to {@link #close()}. If you wish to do something different, you should - * override {@link #closeLuceneIndex()}. + * override {@link #closeIndexWriter()}. * - * @param directory the {@link Directory} on top of wich an - * {@link IndexWriter} should be opened. - * @param openMode see {@link OpenMode} + * @param directory + * the {@link Directory} on top of which an {@link IndexWriter} + * should be opened. + * @param openMode + * see {@link OpenMode} */ - protected void openLuceneIndex (Directory directory, OpenMode openMode) - throws CorruptIndexException, LockObtainFailedException, IOException { + protected void openIndexWriter(Directory directory, OpenMode openMode) + throws IOException { // Make sure we use a MergePolicy which merges segments in-order and thus // keeps the doc IDs ordered as well (this is crucial for the taxonomy // index). - IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_30, + IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, new KeywordAnalyzer()).setOpenMode(openMode).setMergePolicy( new LogByteSizeMergePolicy()); indexWriter = new IndexWriter(directory, config); @@ -250,7 +247,7 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { * Creates a new instance with a default cached as defined by * {@link #defaultTaxonomyWriterCache()}. */ - public LuceneTaxonomyWriter(Directory directory, OpenMode openMode) + public DirectoryTaxonomyWriter(Directory directory, OpenMode openMode) throws CorruptIndexException, LockObtainFailedException, IOException { this(directory, openMode, defaultTaxonomyWriterCache()); } @@ -269,7 +266,7 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { // convenience constructors: - public LuceneTaxonomyWriter(Directory d) + public DirectoryTaxonomyWriter(Directory d) throws CorruptIndexException, LockObtainFailedException, IOException { this(d, OpenMode.CREATE_OR_APPEND); @@ -280,8 +277,9 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { * which commits whatever changes made to it to the underlying * {@link Directory}. */ + @Override public synchronized void close() throws CorruptIndexException, IOException { - closeLuceneIndex(); + closeIndexWriter(); closeResources(); } @@ -316,9 +314,9 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { /** * A hook for extending classes to control closing the {@link IndexWriter} - * returned by {@link #openLuceneIndex}. + * returned by {@link #openIndexWriter}. */ - protected void closeLuceneIndex() throws CorruptIndexException, IOException { + protected void closeIndexWriter() throws CorruptIndexException, IOException { if (indexWriter != null) { indexWriter.close(); indexWriter = null; @@ -413,6 +411,7 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { // potentially even trigger a lengthy merge) locks out other addCategory() // calls - even those which could immediately return a cached value. // We definitely need to fix this situation! + @Override public synchronized int addCategory(CategoryPath categoryPath) throws IOException { // If the category is already in the cache and/or the taxonomy, we @@ -578,6 +577,7 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { * When the index is closed(), commit() is also implicitly done. * See {@link TaxonomyWriter#commit()} */ + @Override public synchronized void commit() throws CorruptIndexException, IOException { indexWriter.commit(); refreshReader(); @@ -585,9 +585,10 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { /** * Like commit(), but also store properties with the index. These properties - * are retrievable by {@link LuceneTaxonomyReader#getCommitUserData}. + * are retrievable by {@link DirectoryTaxonomyReader#getCommitUserData}. * See {@link TaxonomyWriter#commit(Map)}. */ + @Override public synchronized void commit(Map commitUserData) throws CorruptIndexException, IOException { indexWriter.commit(commitUserData); refreshReader(); @@ -597,6 +598,7 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { * prepare most of the work needed for a two-phase commit. * See {@link IndexWriter#prepareCommit}. */ + @Override public synchronized void prepareCommit() throws CorruptIndexException, IOException { indexWriter.prepareCommit(); } @@ -605,6 +607,7 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { * Like above, and also prepares to store user data with the index. * See {@link IndexWriter#prepareCommit(Map)} */ + @Override public synchronized void prepareCommit(Map commitUserData) throws CorruptIndexException, IOException { indexWriter.prepareCommit(commitUserData); } @@ -620,6 +623,7 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { * a category is added to the taxonomy, its ancestors are also added * automatically (including the root, which always get ordinal 0). */ + @Override synchronized public int getSize() { return indexWriter.maxDoc(); } @@ -720,6 +724,7 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { } return parentArray; } + @Override public int getParent(int ordinal) throws IOException { // Note: the following if() just enforces that a user can never ask // for the parent of a nonexistant category - even if the parent array @@ -930,13 +935,17 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { */ public static final class MemoryOrdinalMap implements OrdinalMap { int[] map; + @Override public void setSize(int taxonomySize) { map = new int[taxonomySize]; } + @Override public void addMapping(int origOrdinal, int newOrdinal) { map[origOrdinal] = newOrdinal; } + @Override public void addDone() { /* nothing to do */ } + @Override public int[] getMap() { return map; } @@ -955,15 +964,18 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { new FileOutputStream(tmpfile))); } + @Override public void addMapping(int origOrdinal, int newOrdinal) throws IOException { out.writeInt(origOrdinal); out.writeInt(newOrdinal); } + @Override public void setSize(int taxonomySize) throws IOException { out.writeInt(taxonomySize); } + @Override public void addDone() throws IOException { if (out!=null) { out.close(); @@ -973,6 +985,7 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { int[] map = null; + @Override public int[] getMap() throws IOException { if (map!=null) { return map; @@ -1005,4 +1018,10 @@ public class LuceneTaxonomyWriter implements TaxonomyWriter { return null; } + @Override + public void rollback() throws IOException { + indexWriter.rollback(); + refreshReader(); + } + } diff --git a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/ParentArray.java b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/ParentArray.java similarity index 99% rename from modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/ParentArray.java rename to modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/ParentArray.java index 617d59e0182..2e56dc8ee10 100644 --- a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/ParentArray.java +++ b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/ParentArray.java @@ -1,4 +1,4 @@ -package org.apache.lucene.facet.taxonomy.lucene; +package org.apache.lucene.facet.taxonomy.directory; import java.io.IOException; diff --git a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/package.html b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/package.html similarity index 100% rename from modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/package.html rename to modules/facet/src/java/org/apache/lucene/facet/taxonomy/directory/package.html diff --git a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/writercache/TaxonomyWriterCache.java b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/writercache/TaxonomyWriterCache.java index 8d80ce1f91b..646bdc0192e 100644 --- a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/writercache/TaxonomyWriterCache.java +++ b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/writercache/TaxonomyWriterCache.java @@ -1,7 +1,7 @@ package org.apache.lucene.facet.taxonomy.writercache; import org.apache.lucene.facet.taxonomy.CategoryPath; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -23,7 +23,7 @@ import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; /** * TaxonomyWriterCache is a relatively simple interface for a cache of * category->ordinal mappings, used in TaxonomyWriter implementations - * (such as {@link LuceneTaxonomyWriter}). + * (such as {@link DirectoryTaxonomyWriter}). *

* It basically has put() methods for adding a mapping, and get() for looking * a mapping up the cache. The cache does not guarantee to hold diff --git a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/writercache/lru/NameIntCacheLRU.java b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/writercache/lru/NameIntCacheLRU.java index baecdbb3847..917becdb580 100644 --- a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/writercache/lru/NameIntCacheLRU.java +++ b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/writercache/lru/NameIntCacheLRU.java @@ -119,7 +119,7 @@ class NameIntCacheLRU { * If cache is full remove least recently used entries from cache. * Return true if anything was removed, false otherwise. * - * See comment in {@link LuceneTaxonomyWriter#addToCache(String, Integer)} + * See comment in {@link DirectoryTaxonomyWriter#addToCache(String, Integer)} * for an explanation why we clean 2/3rds of the cache, and not just one * entry. */ diff --git a/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java b/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java index 1c18056db30..30e03222559 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java +++ b/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java @@ -43,8 +43,8 @@ import org.apache.lucene.facet.search.results.FacetResultNode; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyReader; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -137,7 +137,7 @@ public abstract class FacetTestBase extends LuceneTestCase { } RandomIndexWriter iw = new RandomIndexWriter(random, indexDir, getIndexWriterConfig(getAnalyzer())); - TaxonomyWriter taxo = new LuceneTaxonomyWriter(taxoDir, OpenMode.CREATE); + TaxonomyWriter taxo = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE); populateIndex(iw, taxo, getFacetIndexingParams(partitionSize)); @@ -148,7 +148,7 @@ public abstract class FacetTestBase extends LuceneTestCase { iw.close(); // prepare for searching - taxoReader = new LuceneTaxonomyReader(taxoDir); + taxoReader = new DirectoryTaxonomyReader(taxoDir); indexReader = IndexReader.open(indexDir); searcher = newSearcher(indexReader); } diff --git a/modules/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java b/modules/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java index 66fc7ba3295..1ef82eea659 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java +++ b/modules/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java @@ -31,8 +31,8 @@ import org.apache.lucene.facet.search.params.FacetSearchParams; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyReader; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -69,7 +69,7 @@ public class FacetTestUtils { IndexTaxonomyReaderPair pair = new IndexTaxonomyReaderPair(); pair.indexReader = IndexReader.open(dirs[i][0]); pair.indexSearcher = new IndexSearcher(pair.indexReader); - pair.taxReader = new LuceneTaxonomyReader(dirs[i][1]); + pair.taxReader = new DirectoryTaxonomyReader(dirs[i][1]); pairs[i] = pair; } return pairs; @@ -83,7 +83,7 @@ public class FacetTestUtils { pair.indexWriter = new IndexWriter(dirs[i][0], new IndexWriterConfig( LuceneTestCase.TEST_VERSION_CURRENT, new StandardAnalyzer( LuceneTestCase.TEST_VERSION_CURRENT))); - pair.taxWriter = new LuceneTaxonomyWriter(dirs[i][1]); + pair.taxWriter = new DirectoryTaxonomyWriter(dirs[i][1]); pair.indexWriter.commit(); pair.taxWriter.commit(); pairs[i] = pair; diff --git a/modules/facet/src/test/org/apache/lucene/facet/enhancements/TwoEnhancementsTest.java b/modules/facet/src/test/org/apache/lucene/facet/enhancements/TwoEnhancementsTest.java index 5a38ba23b61..866bb11f511 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/enhancements/TwoEnhancementsTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/enhancements/TwoEnhancementsTest.java @@ -21,7 +21,7 @@ import org.apache.lucene.facet.enhancements.params.EnhancementsIndexingParams; import org.apache.lucene.facet.search.DrillDown; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -58,7 +58,7 @@ public class TwoEnhancementsTest extends LuceneTestCase { RandomIndexWriter indexWriter = new RandomIndexWriter(random, indexDir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false))); - TaxonomyWriter taxo = new LuceneTaxonomyWriter(taxoDir); + TaxonomyWriter taxo = new DirectoryTaxonomyWriter(taxoDir); // a category document builder will add the categories to a document // once build() is called @@ -103,7 +103,7 @@ public class TwoEnhancementsTest extends LuceneTestCase { RandomIndexWriter indexWriter = new RandomIndexWriter(random, indexDir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false))); - TaxonomyWriter taxo = new LuceneTaxonomyWriter(taxoDir); + TaxonomyWriter taxo = new DirectoryTaxonomyWriter(taxoDir); // a category document builder will add the categories to a document // once build() is called diff --git a/modules/facet/src/test/org/apache/lucene/facet/enhancements/association/CustomAssociationPropertyTest.java b/modules/facet/src/test/org/apache/lucene/facet/enhancements/association/CustomAssociationPropertyTest.java index 5acace10dfc..09bcab41a2b 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/enhancements/association/CustomAssociationPropertyTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/enhancements/association/CustomAssociationPropertyTest.java @@ -16,8 +16,8 @@ import org.apache.lucene.facet.index.CategoryContainer; import org.apache.lucene.facet.index.attributes.CategoryAttributeImpl; import org.apache.lucene.facet.index.attributes.CategoryProperty; import org.apache.lucene.facet.taxonomy.CategoryPath; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -59,7 +59,7 @@ public class CustomAssociationPropertyTest extends LuceneTestCase { RandomIndexWriter w = new RandomIndexWriter(random, iDir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.KEYWORD, false))); - LuceneTaxonomyWriter taxoW = new LuceneTaxonomyWriter(tDir); + DirectoryTaxonomyWriter taxoW = new DirectoryTaxonomyWriter(tDir); CategoryContainer cc = new CategoryContainer(); EnhancementsDocumentBuilder builder = new EnhancementsDocumentBuilder(taxoW, iParams); @@ -75,7 +75,7 @@ public class CustomAssociationPropertyTest extends LuceneTestCase { IndexReader reader = w.getReader(); w.close(); - LuceneTaxonomyReader taxo = new LuceneTaxonomyReader(tDir); + DirectoryTaxonomyReader taxo = new DirectoryTaxonomyReader(tDir); String field = iParams.getCategoryListParams(new CategoryPath("0")).getTerm().field(); AssociationsPayloadIterator api = new AssociationsPayloadIterator(reader, field); diff --git a/modules/facet/src/test/org/apache/lucene/facet/index/FacetsPayloadProcessorProviderTest.java b/modules/facet/src/test/org/apache/lucene/facet/index/FacetsPayloadProcessorProviderTest.java index 86fef2c4093..5073050031d 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/index/FacetsPayloadProcessorProviderTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/index/FacetsPayloadProcessorProviderTest.java @@ -23,8 +23,8 @@ import org.apache.lucene.facet.search.params.FacetSearchParams; import org.apache.lucene.facet.search.results.FacetResult; import org.apache.lucene.facet.search.results.FacetResultNode; import org.apache.lucene.facet.taxonomy.CategoryPath; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -68,7 +68,7 @@ public class FacetsPayloadProcessorProviderTest extends LuceneTestCase { private void verifyResults(Directory dir, Directory taxDir) throws IOException { IndexReader reader1 = IndexReader.open(dir); - LuceneTaxonomyReader taxReader = new LuceneTaxonomyReader(taxDir); + DirectoryTaxonomyReader taxReader = new DirectoryTaxonomyReader(taxDir); IndexSearcher searcher = newSearcher(reader1); FacetSearchParams fsp = new FacetSearchParams(); fsp.addFacetRequest(new CountFacetRequest(new CategoryPath("tag"), NUM_DOCS)); @@ -94,7 +94,7 @@ public class FacetsPayloadProcessorProviderTest extends LuceneTestCase { new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)); RandomIndexWriter writer = new RandomIndexWriter(random, dir, config); - LuceneTaxonomyWriter taxonomyWriter = new LuceneTaxonomyWriter(taxDir); + DirectoryTaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter(taxDir); for (int i = 1; i <= NUM_DOCS; i++) { Document doc = new Document(); List categoryPaths = new ArrayList(i + 1); diff --git a/modules/facet/src/test/org/apache/lucene/facet/index/categorypolicy/OrdinalPolicyTest.java b/modules/facet/src/test/org/apache/lucene/facet/index/categorypolicy/OrdinalPolicyTest.java index 00b5c27dfea..7514143a8f2 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/index/categorypolicy/OrdinalPolicyTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/index/categorypolicy/OrdinalPolicyTest.java @@ -10,7 +10,7 @@ import org.apache.lucene.facet.index.categorypolicy.OrdinalPolicy; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyReader; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -48,7 +48,7 @@ public class OrdinalPolicyTest extends LuceneTestCase { public void testNonTopLevelOrdinalPolicy() throws Exception { Directory dir = newDirectory(); TaxonomyWriter taxonomy = null; - taxonomy = new LuceneTaxonomyWriter(dir); + taxonomy = new DirectoryTaxonomyWriter(dir); int[] topLevelOrdinals = new int[10]; String[] topLevelStrings = new String[10]; diff --git a/modules/facet/src/test/org/apache/lucene/facet/index/categorypolicy/PathPolicyTest.java b/modules/facet/src/test/org/apache/lucene/facet/index/categorypolicy/PathPolicyTest.java index 7f7b651151c..df7f9f3a065 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/index/categorypolicy/PathPolicyTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/index/categorypolicy/PathPolicyTest.java @@ -9,7 +9,7 @@ import org.apache.lucene.facet.index.categorypolicy.NonTopLevelPathPolicy; import org.apache.lucene.facet.index.categorypolicy.PathPolicy; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -54,7 +54,7 @@ public class PathPolicyTest extends LuceneTestCase { public void testNonTopLevelPathPolicy() throws Exception { Directory dir = newDirectory(); TaxonomyWriter taxonomy = null; - taxonomy = new LuceneTaxonomyWriter(dir); + taxonomy = new DirectoryTaxonomyWriter(dir); CategoryPath[] topLevelPaths = new CategoryPath[10]; String[] topLevelStrings = new String[10]; diff --git a/modules/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java b/modules/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java index c59f1c63fdf..eb579840b36 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java @@ -19,7 +19,7 @@ import org.apache.lucene.facet.index.streaming.CategoryAttributesStream; import org.apache.lucene.facet.index.streaming.CategoryListTokenizer; import org.apache.lucene.facet.index.streaming.CategoryParentsStream; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -50,7 +50,7 @@ public class CategoryParentsStreamTest extends CategoryContainerTestBase { @Test public void testStreamDefaultParams() throws IOException { Directory directory = newDirectory(); - TaxonomyWriter taxonomyWriter = new LuceneTaxonomyWriter( + TaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter( directory); CategoryParentsStream stream = new CategoryParentsStream( new CategoryAttributesStream(categoryContainer), @@ -77,7 +77,7 @@ public class CategoryParentsStreamTest extends CategoryContainerTestBase { @Test public void testStreamNonTopLevelParams() throws IOException { Directory directory = newDirectory(); - final TaxonomyWriter taxonomyWriter = new LuceneTaxonomyWriter( + final TaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter( directory); FacetIndexingParams indexingParams = new DefaultFacetIndexingParams() { @Override @@ -118,7 +118,7 @@ public class CategoryParentsStreamTest extends CategoryContainerTestBase { @Test public void testNoRetainableAttributes() throws IOException, FacetException { Directory directory = newDirectory(); - TaxonomyWriter taxonomyWriter = new LuceneTaxonomyWriter(directory); + TaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter(directory); new CategoryParentsStream(new CategoryAttributesStream(categoryContainer), taxonomyWriter, new DefaultFacetIndexingParams()); @@ -152,7 +152,7 @@ public class CategoryParentsStreamTest extends CategoryContainerTestBase { @Test public void testRetainableAttributes() throws IOException, FacetException { Directory directory = newDirectory(); - TaxonomyWriter taxonomyWriter = new LuceneTaxonomyWriter( + TaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter( directory); FacetIndexingParams indexingParams = new DefaultFacetIndexingParams(); diff --git a/modules/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryTokenizerTest.java b/modules/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryTokenizerTest.java index 14804e6596b..8d52ab158f7 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryTokenizerTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryTokenizerTest.java @@ -17,7 +17,7 @@ import org.apache.lucene.facet.index.streaming.CategoryAttributesStream; import org.apache.lucene.facet.index.streaming.CategoryTokenizer; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -47,7 +47,7 @@ public class CategoryTokenizerTest extends CategoryContainerTestBase { @Test public void testTokensDefaultParams() throws IOException { Directory directory = newDirectory(); - TaxonomyWriter taxonomyWriter = new LuceneTaxonomyWriter( + TaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter( directory); DefaultFacetIndexingParams indexingParams = new DefaultFacetIndexingParams(); CategoryTokenizer tokenizer = new CategoryTokenizer( @@ -86,7 +86,7 @@ public class CategoryTokenizerTest extends CategoryContainerTestBase { @Test public void testLongCategoryPath() throws IOException { Directory directory = newDirectory(); - TaxonomyWriter taxonomyWriter = new LuceneTaxonomyWriter( + TaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter( directory); List longCategory = new ArrayList(); diff --git a/modules/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java b/modules/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java index 20fdc920699..2cfa4387ac0 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/search/DrillDownTest.java @@ -28,8 +28,8 @@ import org.apache.lucene.facet.index.params.PerDimensionIndexingParams; import org.apache.lucene.facet.search.params.FacetSearchParams; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -53,7 +53,7 @@ public class DrillDownTest extends LuceneTestCase { private FacetSearchParams defaultParams = new FacetSearchParams(); private FacetSearchParams nonDefaultParams; private static IndexReader reader; - private static LuceneTaxonomyReader taxo; + private static DirectoryTaxonomyReader taxo; private static Directory dir; private static Directory taxoDir; @@ -74,7 +74,7 @@ public class DrillDownTest extends LuceneTestCase { newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.KEYWORD, false))); taxoDir = newDirectory(); - TaxonomyWriter taxoWriter = new LuceneTaxonomyWriter(taxoDir); + TaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir); for (int i = 0; i < 100; i++) { ArrayList paths = new ArrayList(); @@ -100,7 +100,7 @@ public class DrillDownTest extends LuceneTestCase { reader = writer.getReader(); writer.close(); - taxo = new LuceneTaxonomyReader(taxoDir); + taxo = new DirectoryTaxonomyReader(taxoDir); } @Test @@ -149,6 +149,8 @@ public class DrillDownTest extends LuceneTestCase { Query q4 = DrillDown.query(defaultParams, fooQuery, new CategoryPath("b")); docs = searcher.search(q4, 100); assertEquals(10, docs.totalHits); + + searcher.close(); } @Test @@ -170,6 +172,8 @@ public class DrillDownTest extends LuceneTestCase { Query q4 = DrillDown.query(fooQuery, new CategoryPath("b")); docs = searcher.search(q4, 100); assertEquals(10, docs.totalHits); + + searcher.close(); } @AfterClass diff --git a/modules/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java b/modules/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java index d68b9dcf0b7..898f7a061e5 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java +++ b/modules/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java @@ -38,8 +38,8 @@ import org.apache.lucene.facet.search.results.FacetResultNode; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyReader; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -67,7 +67,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase { RandomIndexWriter iw = new RandomIndexWriter(random, dirs[0][0], newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false))); // create and open a taxonomy writer - TaxonomyWriter tw = new LuceneTaxonomyWriter(dirs[0][1], OpenMode.CREATE); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1], OpenMode.CREATE); /** * Configure with no custom counting lists @@ -80,7 +80,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase { tw.commit(); // prepare index reader and taxonomy. - TaxonomyReader tr = new LuceneTaxonomyReader(dirs[0][1]); + TaxonomyReader tr = new DirectoryTaxonomyReader(dirs[0][1]); // prepare searcher to search against IndexSearcher searcher = newSearcher(ir); @@ -109,7 +109,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase { RandomIndexWriter iw = new RandomIndexWriter(random, dirs[0][0], newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false))); // create and open a taxonomy writer - TaxonomyWriter tw = new LuceneTaxonomyWriter(dirs[0][1], + TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1], OpenMode.CREATE); PerDimensionIndexingParams iParams = new PerDimensionIndexingParams(); @@ -121,7 +121,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase { tw.commit(); // prepare index reader and taxonomy. - TaxonomyReader tr = new LuceneTaxonomyReader(dirs[0][1]); + TaxonomyReader tr = new DirectoryTaxonomyReader(dirs[0][1]); // prepare searcher to search against IndexSearcher searcher = newSearcher(ir); @@ -150,7 +150,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase { RandomIndexWriter iw = new RandomIndexWriter(random, dirs[0][0], newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false))); // create and open a taxonomy writer - TaxonomyWriter tw = new LuceneTaxonomyWriter(dirs[0][1], + TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1], OpenMode.CREATE); PerDimensionIndexingParams iParams = new PerDimensionIndexingParams(); @@ -164,7 +164,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase { tw.commit(); // prepare index reader and taxonomy. - TaxonomyReader tr = new LuceneTaxonomyReader(dirs[0][1]); + TaxonomyReader tr = new DirectoryTaxonomyReader(dirs[0][1]); // prepare searcher to search against IndexSearcher searcher = newSearcher(ir); @@ -199,7 +199,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase { RandomIndexWriter iw = new RandomIndexWriter(random, dirs[0][0], newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false))); // create and open a taxonomy writer - TaxonomyWriter tw = new LuceneTaxonomyWriter(dirs[0][1], OpenMode.CREATE); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1], OpenMode.CREATE); PerDimensionIndexingParams iParams = new PerDimensionIndexingParams(); iParams.addCategoryListParams(new CategoryPath("Band"), @@ -212,7 +212,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase { tw.commit(); // prepare index reader and taxonomy. - TaxonomyReader tr = new LuceneTaxonomyReader(dirs[0][1]); + TaxonomyReader tr = new DirectoryTaxonomyReader(dirs[0][1]); // prepare searcher to search against IndexSearcher searcher = newSearcher(ir); @@ -240,7 +240,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase { RandomIndexWriter iw = new RandomIndexWriter(random, dirs[0][0], newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false))); // create and open a taxonomy writer - TaxonomyWriter tw = new LuceneTaxonomyWriter(dirs[0][1], + TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1], OpenMode.CREATE); PerDimensionIndexingParams iParams = new PerDimensionIndexingParams(); @@ -257,7 +257,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase { tw.commit(); // prepare index reader and taxonomy. - TaxonomyReader tr = new LuceneTaxonomyReader(dirs[0][1]); + TaxonomyReader tr = new DirectoryTaxonomyReader(dirs[0][1]); // prepare searcher to search against IndexSearcher searcher = newSearcher(ir); diff --git a/modules/facet/src/test/org/apache/lucene/facet/search/TestTopKInEachNodeResultHandler.java b/modules/facet/src/test/org/apache/lucene/facet/search/TestTopKInEachNodeResultHandler.java index d70d0eda98e..0583bc0c8e7 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/search/TestTopKInEachNodeResultHandler.java +++ b/modules/facet/src/test/org/apache/lucene/facet/search/TestTopKInEachNodeResultHandler.java @@ -29,8 +29,8 @@ import org.apache.lucene.facet.search.results.FacetResult; import org.apache.lucene.facet.search.results.FacetResultNode; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; import org.apache.lucene.facet.util.PartitionsUtils; /** @@ -80,7 +80,7 @@ public class TestTopKInEachNodeResultHandler extends LuceneTestCase { RandomIndexWriter iw = new RandomIndexWriter(random, iDir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.CREATE)); - TaxonomyWriter tw = new LuceneTaxonomyWriter(tDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(tDir); prvt_add(iParams, iw, tw, "a", "b"); prvt_add(iParams, iw, tw, "a", "b", "1"); prvt_add(iParams, iw, tw, "a", "b", "1"); @@ -104,7 +104,7 @@ public class TestTopKInEachNodeResultHandler extends LuceneTestCase { tw.close(); IndexSearcher is = newSearcher(ir); - LuceneTaxonomyReader tr = new LuceneTaxonomyReader(tDir); + DirectoryTaxonomyReader tr = new DirectoryTaxonomyReader(tDir); // Get all of the documents and run the query, then do different // facet counts and compare to control diff --git a/modules/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCountsCache.java b/modules/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCountsCache.java index 8b54182d9b0..ec1e4b38367 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCountsCache.java +++ b/modules/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCountsCache.java @@ -34,8 +34,8 @@ import org.apache.lucene.facet.search.results.FacetResultNode; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyReader; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.SlowRAMDirectory; import org.apache.lucene.util._TestUtil; @@ -67,12 +67,12 @@ public class TestTotalFacetCountsCache extends LuceneTestCase { */ private static class TFCThread extends Thread { private final IndexReader r; - private final LuceneTaxonomyReader tr; + private final DirectoryTaxonomyReader tr; private final FacetIndexingParams iParams; TotalFacetCounts tfc; - public TFCThread(IndexReader r, LuceneTaxonomyReader tr, FacetIndexingParams iParams) { + public TFCThread(IndexReader r, DirectoryTaxonomyReader tr, FacetIndexingParams iParams) { this.r = r; this.tr = tr; this.iParams = iParams; @@ -156,7 +156,7 @@ public class TestTotalFacetCountsCache extends LuceneTestCase { // Open the slow readers IndexReader slowIndexReader = IndexReader.open(indexDir); - TaxonomyReader slowTaxoReader = new LuceneTaxonomyReader(taxoDir); + TaxonomyReader slowTaxoReader = new DirectoryTaxonomyReader(taxoDir); // Class to perform search and return results as threads class Multi extends Thread { @@ -421,7 +421,7 @@ public class TestTotalFacetCountsCache extends LuceneTestCase { // Write index using 'normal' directories IndexWriter w = new IndexWriter(indexDir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false))); - LuceneTaxonomyWriter tw = new LuceneTaxonomyWriter(taxoDir); + DirectoryTaxonomyWriter tw = new DirectoryTaxonomyWriter(taxoDir); DefaultFacetIndexingParams iParams = new DefaultFacetIndexingParams(); // Add documents and facets for (int i = 0; i < 1000; i++) { @@ -434,7 +434,7 @@ public class TestTotalFacetCountsCache extends LuceneTestCase { taxoDir.setSleepMillis(1); IndexReader r = IndexReader.open(indexDir); - LuceneTaxonomyReader tr = new LuceneTaxonomyReader(taxoDir); + DirectoryTaxonomyReader tr = new DirectoryTaxonomyReader(taxoDir); // Create and start threads. Thread1 should lock the cache and calculate // the TFC array. The second thread should block until the first is diff --git a/modules/facet/src/test/org/apache/lucene/facet/search/association/AssociationsFacetRequestTest.java b/modules/facet/src/test/org/apache/lucene/facet/search/association/AssociationsFacetRequestTest.java index 89dee04e6e9..11cdeb1a874 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/search/association/AssociationsFacetRequestTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/search/association/AssociationsFacetRequestTest.java @@ -29,8 +29,8 @@ import org.apache.lucene.facet.search.params.association.AssociationIntSumFacetR import org.apache.lucene.facet.search.results.FacetResult; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -69,7 +69,7 @@ public class AssociationsFacetRequestTest extends LuceneTestCase { RandomIndexWriter writer = new RandomIndexWriter(random, dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.KEYWORD, false))); - TaxonomyWriter taxoWriter = new LuceneTaxonomyWriter(taxoDir); + TaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir); EnhancementsDocumentBuilder builder = new EnhancementsDocumentBuilder( taxoWriter, new DefaultEnhancementsIndexingParams( @@ -106,7 +106,7 @@ public class AssociationsFacetRequestTest extends LuceneTestCase { @Test public void testIntSumAssociation() throws Exception { - LuceneTaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir); + DirectoryTaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir); // facet requests for two facets FacetSearchParams fsp = new FacetSearchParams(); @@ -132,7 +132,7 @@ public class AssociationsFacetRequestTest extends LuceneTestCase { @Test public void testFloatSumAssociation() throws Exception { - LuceneTaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir); + DirectoryTaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir); // facet requests for two facets FacetSearchParams fsp = new FacetSearchParams(); @@ -161,7 +161,7 @@ public class AssociationsFacetRequestTest extends LuceneTestCase { // Same category list cannot be aggregated by two different aggregators. If // you want to do that, you need to separate the categories into two // category list (you'll still have one association list). - LuceneTaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir); + DirectoryTaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir); // facet requests for two facets FacetSearchParams fsp = new FacetSearchParams(); diff --git a/modules/facet/src/test/org/apache/lucene/facet/search/params/FacetRequestTest.java b/modules/facet/src/test/org/apache/lucene/facet/search/params/FacetRequestTest.java index ff2e0609833..f86d36b8f57 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/search/params/FacetRequestTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/search/params/FacetRequestTest.java @@ -9,7 +9,7 @@ import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.facet.search.FacetResultsHandler; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; /** * Licensed to the Apache Software Foundation (ASF) under one or more @@ -58,8 +58,8 @@ public class FacetRequestTest extends LuceneTestCase { // create empty indexes, so that LTR ctor won't complain about a missing index. new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, null)).close(); new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, null)).close(); - TaxonomyReader tr1 = new LuceneTaxonomyReader(dir1); - TaxonomyReader tr2 = new LuceneTaxonomyReader(dir2); + TaxonomyReader tr1 = new DirectoryTaxonomyReader(dir1); + TaxonomyReader tr2 = new DirectoryTaxonomyReader(dir2); FacetResultsHandler frh1 = fr.createFacetResultsHandler(tr1); FacetResultsHandler frh2 = fr.createFacetResultsHandler(tr2); assertTrue("should not return the same FacetResultHandler instance for different TaxonomyReader instances", frh1 != frh2); @@ -77,7 +77,7 @@ public class FacetRequestTest extends LuceneTestCase { Directory dir = newDirectory(); // create empty indexes, so that LTR ctor won't complain about a missing index. new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, null)).close(); - TaxonomyReader tr = new LuceneTaxonomyReader(dir); + TaxonomyReader tr = new DirectoryTaxonomyReader(dir); FacetResultsHandler frh = fr.createFacetResultsHandler(tr); fr.setDepth(10); assertEquals(FacetRequest.DEFAULT_DEPTH, frh.getFacetRequest().getDepth()); diff --git a/modules/facet/src/test/org/apache/lucene/facet/search/params/FacetSearchParamsTest.java b/modules/facet/src/test/org/apache/lucene/facet/search/params/FacetSearchParamsTest.java index 591636643b0..40df7ba15c7 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/search/params/FacetSearchParamsTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/search/params/FacetSearchParamsTest.java @@ -8,8 +8,8 @@ import org.apache.lucene.facet.index.params.DefaultFacetIndexingParams; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyReader; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; import org.apache.lucene.facet.util.PartitionsUtils; /** @@ -37,8 +37,8 @@ public class FacetSearchParamsTest extends LuceneTestCase { assertEquals("unexpected default facet indexing params class", DefaultFacetIndexingParams.class.getName(), fsp.getFacetIndexingParams().getClass().getName()); assertEquals("no facet requests should be added by default", 0, fsp.getFacetRequests().size()); Directory dir = newDirectory(); - new LuceneTaxonomyWriter(dir).close(); - TaxonomyReader tr = new LuceneTaxonomyReader(dir); + new DirectoryTaxonomyWriter(dir).close(); + TaxonomyReader tr = new DirectoryTaxonomyReader(dir); assertEquals("unexpected partition offset for 0 categories", 1, PartitionsUtils.partitionOffset(fsp, 1, tr)); assertEquals("unexpected partition size for 0 categories", 1, PartitionsUtils.partitionSize(fsp,tr)); tr.close(); @@ -56,11 +56,11 @@ public class FacetSearchParamsTest extends LuceneTestCase { public void testPartitionSizeWithCategories() throws Exception { FacetSearchParams fsp = new FacetSearchParams(); Directory dir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(dir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(dir); tw.addCategory(new CategoryPath("a")); tw.commit(); tw.close(); - TaxonomyReader tr = new LuceneTaxonomyReader(dir); + TaxonomyReader tr = new DirectoryTaxonomyReader(dir); assertEquals("unexpected partition offset for 1 categories", 2, PartitionsUtils.partitionOffset(fsp, 1, tr)); assertEquals("unexpected partition size for 1 categories", 2, PartitionsUtils.partitionSize(fsp,tr)); tr.close(); diff --git a/modules/facet/src/test/org/apache/lucene/facet/search/params/MultiIteratorsPerCLParamsTest.java b/modules/facet/src/test/org/apache/lucene/facet/search/params/MultiIteratorsPerCLParamsTest.java index 3fcfcccdc25..3689d04c707 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/search/params/MultiIteratorsPerCLParamsTest.java +++ b/modules/facet/src/test/org/apache/lucene/facet/search/params/MultiIteratorsPerCLParamsTest.java @@ -32,8 +32,8 @@ import org.apache.lucene.facet.search.results.IntermediateFacetResult; import org.apache.lucene.facet.taxonomy.CategoryPath; import org.apache.lucene.facet.taxonomy.TaxonomyReader; import org.apache.lucene.facet.taxonomy.TaxonomyWriter; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; import org.apache.lucene.facet.util.ScoredDocIdsUtils; /** @@ -93,7 +93,7 @@ public class MultiIteratorsPerCLParamsTest extends LuceneTestCase { Directory taxoDir = newDirectory(); populateIndex(iParams, indexDir, taxoDir); - TaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir); + TaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir); IndexReader reader = IndexReader.open(indexDir); CategoryListCache clCache = null; @@ -168,7 +168,7 @@ public class MultiIteratorsPerCLParamsTest extends LuceneTestCase { Directory taxoDir) throws Exception { RandomIndexWriter writer = new RandomIndexWriter(random, indexDir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.KEYWORD, false))); - TaxonomyWriter taxoWriter = new LuceneTaxonomyWriter(taxoDir); + TaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir); for (CategoryPath[] categories : perDocCategories) { writer.addDocument(new CategoryDocumentBuilder(taxoWriter, iParams) diff --git a/modules/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyCombined.java b/modules/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyCombined.java index a92dbad8c9a..52f0f88e1f4 100644 --- a/modules/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyCombined.java +++ b/modules/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyCombined.java @@ -14,8 +14,8 @@ import org.junit.Test; import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.facet.taxonomy.TaxonomyReader.ChildrenArrays; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyReader; -import org.apache.lucene.facet.taxonomy.lucene.LuceneTaxonomyWriter; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader; +import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter; import org.apache.lucene.util.SlowRAMDirectory; /** @@ -159,7 +159,7 @@ public class TestTaxonomyCombined extends LuceneTestCase { @Test public void testWriter() throws Exception { Directory indexDir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); fillTaxonomy(tw); // Also check TaxonomyWriter.getSize() - see that the taxonomy's size // is what we expect it to be. @@ -175,7 +175,7 @@ public class TestTaxonomyCombined extends LuceneTestCase { @Test public void testWriterTwice() throws Exception { Directory indexDir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); fillTaxonomy(tw); // run fillTaxonomy again - this will try to add the same categories // again, and check that we see the same ordinal paths again, not @@ -197,10 +197,10 @@ public class TestTaxonomyCombined extends LuceneTestCase { @Test public void testWriterTwice2() throws Exception { Directory indexDir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); fillTaxonomy(tw); tw.close(); - tw = new LuceneTaxonomyWriter(indexDir); + tw = new DirectoryTaxonomyWriter(indexDir); // run fillTaxonomy again - this will try to add the same categories // again, and check that we see the same ordinals again, not different // ones, and that the number of categories hasn't grown by the new @@ -222,7 +222,7 @@ public class TestTaxonomyCombined extends LuceneTestCase { public void testWriterTwice3() throws Exception { Directory indexDir = newDirectory(); // First, create and fill the taxonomy - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); fillTaxonomy(tw); tw.close(); // Now, open the same taxonomy and add the same categories again. @@ -231,7 +231,7 @@ public class TestTaxonomyCombined extends LuceneTestCase { // all into memory and close it's reader. The bug was that it closed // the reader, but forgot that it did (because it didn't set the reader // reference to null). - tw = new LuceneTaxonomyWriter(indexDir); + tw = new DirectoryTaxonomyWriter(indexDir); fillTaxonomy(tw); // Add one new category, just to make commit() do something: tw.addCategory(new CategoryPath("hi")); @@ -253,7 +253,7 @@ public class TestTaxonomyCombined extends LuceneTestCase { @Test public void testWriterSimpler() throws Exception { Directory indexDir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); assertEquals(1, tw.getSize()); // the root only // Test that adding a new top-level category works assertEquals(1, tw.addCategory(new CategoryPath("a"))); @@ -297,12 +297,12 @@ public class TestTaxonomyCombined extends LuceneTestCase { @Test public void testRootOnly() throws Exception { Directory indexDir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); // right after opening the index, it should already contain the // root, so have size 1: assertEquals(1, tw.getSize()); tw.close(); - TaxonomyReader tr = new LuceneTaxonomyReader(indexDir); + TaxonomyReader tr = new DirectoryTaxonomyReader(indexDir); assertEquals(1, tr.getSize()); assertEquals(0, tr.getPath(0).length()); assertEquals(TaxonomyReader.INVALID_ORDINAL, tr.getParent(0)); @@ -319,9 +319,9 @@ public class TestTaxonomyCombined extends LuceneTestCase { @Test public void testRootOnly2() throws Exception { Directory indexDir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); tw.commit(); - TaxonomyReader tr = new LuceneTaxonomyReader(indexDir); + TaxonomyReader tr = new DirectoryTaxonomyReader(indexDir); assertEquals(1, tr.getSize()); assertEquals(0, tr.getPath(0).length()); assertEquals(TaxonomyReader.INVALID_ORDINAL, tr.getParent(0)); @@ -339,10 +339,10 @@ public class TestTaxonomyCombined extends LuceneTestCase { @Test public void testReaderBasic() throws Exception { Directory indexDir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); fillTaxonomy(tw); tw.close(); - TaxonomyReader tr = new LuceneTaxonomyReader(indexDir); + TaxonomyReader tr = new DirectoryTaxonomyReader(indexDir); // test TaxonomyReader.getSize(): assertEquals(expectedCategories.length, tr.getSize()); @@ -398,10 +398,10 @@ public class TestTaxonomyCombined extends LuceneTestCase { @Test public void testReaderParent() throws Exception { Directory indexDir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); fillTaxonomy(tw); tw.close(); - TaxonomyReader tr = new LuceneTaxonomyReader(indexDir); + TaxonomyReader tr = new DirectoryTaxonomyReader(indexDir); // check that the parent of the root ordinal is the invalid ordinal: assertEquals(TaxonomyReader.INVALID_ORDINAL, tr.getParent(0)); @@ -463,11 +463,11 @@ public class TestTaxonomyCombined extends LuceneTestCase { @Test public void testWriterParent1() throws Exception { Directory indexDir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); fillTaxonomy(tw); tw.close(); - tw = new LuceneTaxonomyWriter(indexDir); - TaxonomyReader tr = new LuceneTaxonomyReader(indexDir); + tw = new DirectoryTaxonomyWriter(indexDir); + TaxonomyReader tr = new DirectoryTaxonomyReader(indexDir); checkWriterParent(tr, tw); @@ -479,10 +479,10 @@ public class TestTaxonomyCombined extends LuceneTestCase { @Test public void testWriterParent2() throws Exception { Directory indexDir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); fillTaxonomy(tw); tw.commit(); - TaxonomyReader tr = new LuceneTaxonomyReader(indexDir); + TaxonomyReader tr = new DirectoryTaxonomyReader(indexDir); checkWriterParent(tr, tw); @@ -542,10 +542,10 @@ public class TestTaxonomyCombined extends LuceneTestCase { @Test public void testReaderParentArray() throws Exception { Directory indexDir = newDirectory(); - TaxonomyWriter tw = new LuceneTaxonomyWriter(indexDir); + TaxonomyWriter tw = new DirectoryTaxonomyWriter(indexDir); fillTaxonomy(tw); tw.close(); - TaxonomyReader tr = new LuceneTaxonomyReader(indexDir); + TaxonomyReader tr = new DirectoryTaxonomyReader(indexDir); int[] parents = tr.getParentArray(); assertEquals(tr.getSize(), parents.length); for (int i=0; i= copytr.getSize()); } else { @@ -188,8 +188,8 @@ public class TestAddTaxonomies extends LuceneTestCase { // Check that all the new categories in the main taxonomy are in // lexicographic order. This isn't a requirement of our API, but happens // this way in our current implementation. - TaxonomyReader tr = new LuceneTaxonomyReader(dirs[0]); - TaxonomyReader copytr = new LuceneTaxonomyReader(copydirs[0]); + TaxonomyReader tr = new DirectoryTaxonomyReader(dirs[0]); + TaxonomyReader copytr = new DirectoryTaxonomyReader(copydirs[0]); if (tr.getSize() > copytr.getSize()) { String prev = tr.getPath(copytr.getSize()).toString(); for (int j=copytr.getSize()+1; j