You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2013/01/30 19:31:08 UTC
svn commit: r1440578 [1/2] - in /lucene/dev/trunk/lucene: ./ demo/
demo/src/java/org/apache/lucene/demo/facet/
demo/src/java/org/apache/lucene/demo/facet/adaptive/
demo/src/java/org/apache/lucene/demo/facet/association/
demo/src/java/org/apache/lucene/...
Author: shaie
Date: Wed Jan 30 18:31:07 2013
New Revision: 1440578
URL: http://svn.apache.org/viewvc?rev=1440578&view=rev
Log:
LUCENE-3998: consolidate facet module examples under demo
Added:
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/ExampleResult.java
- copied, changed from r1440418, lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/ExampleResult.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/ExampleUtils.java
- copied, changed from r1440418, lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/ExampleUtils.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/
- copied from r1440418, lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/adaptive/
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/package.html (with props)
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/
- copied from r1440418, lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/association/
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/package.html (with props)
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/
- copied from r1440418, lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/multiCL/
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/package.html (with props)
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/package.html (with props)
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/
- copied from r1440418, lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/simple/
lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/
lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestAdaptiveExample.java
- copied, changed from r1440418, lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestAdaptiveExample.java
lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestAssociationExample.java
- copied, changed from r1440418, lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestAssociationExample.java
lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestMultiCLExample.java
- copied, changed from r1440418, lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestMultiCLExample.java
lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestSimpleExample.java
- copied, changed from r1440418, lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestSimpleExample.java
lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/util/TaxonomyMergeUtils.java
- copied, changed from r1440418, lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java
Removed:
lucene/dev/trunk/lucene/facet/src/examples/
lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/
Modified:
lucene/dev/trunk/lucene/build.xml
lucene/dev/trunk/lucene/demo/build.xml
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/AdaptiveMain.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/AdaptiveSearcher.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsIndexer.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsMain.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsSearcher.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsUtils.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLIndexer.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLMain.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLSearcher.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleIndexer.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleMain.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleSearcher.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleUtils.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/package.html
lucene/dev/trunk/lucene/facet/build.xml
lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java
lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/index/OrdinalMappingReaderTest.java
lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java
lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCounts.java
lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCountsCache.java
lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/sampling/OversampleWithDepthTest.java
lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java
Modified: lucene/dev/trunk/lucene/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/build.xml?rev=1440578&r1=1440577&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/build.xml (original)
+++ lucene/dev/trunk/lucene/build.xml Wed Jan 30 18:31:07 2013
@@ -191,8 +191,7 @@
<exclude name="analysis/stempel/classes/java/org/egothor/stemmer/Compile.class"/>
<exclude name="analysis/stempel/classes/java/org/egothor/stemmer/DiffIt.class"/>
<exclude name="benchmark/**"/>
- <exclude name="demo/classes/java/org/apache/lucene/demo/IndexFiles.class"/>
- <exclude name="demo/classes/java/org/apache/lucene/demo/SearchFiles.class"/>
+ <exclude name="demo/classes/java/org/apache/lucene/**"/>
<exclude name="misc/classes/java/org/apache/lucene/index/CompoundFileExtractor.class"/>
<exclude name="misc/classes/java/org/apache/lucene/index/IndexSplitter.class"/>
<exclude name="misc/classes/java/org/apache/lucene/index/MultiPassIndexSplitter.class"/>
Modified: lucene/dev/trunk/lucene/demo/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/build.xml?rev=1440578&r1=1440577&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/build.xml (original)
+++ lucene/dev/trunk/lucene/demo/build.xml Wed Jan 30 18:31:07 2013
@@ -33,20 +33,22 @@
<pathelement path="${analyzers-common.jar}"/>
<pathelement path="${queryparser.jar}"/>
<pathelement path="${lucene-core.jar}"/>
+ <pathelement path="${facet.jar}"/>
<fileset dir="lib"/>
</path>
- <target name="javadocs" depends="javadocs-analyzers-common,javadocs-queryparser,compile-core">
+ <target name="javadocs" depends="javadocs-analyzers-common,javadocs-queryparser,javadocs-facet,compile-core">
<!-- we link the example source in the javadocs, as its ref'ed elsewhere -->
<invoke-module-javadoc linksource="yes">
<links>
<link href="../analyzers-common"/>
<link href="../queryparser"/>
+ <link href="../facet"/>
</links>
</invoke-module-javadoc>
</target>
- <target name="compile-core" depends="jar-analyzers-common,jar-queryparser,common.compile-core" />
+ <target name="compile-core" depends="jar-analyzers-common,jar-queryparser,jar-facet,common.compile-core" />
<target name="default" depends="jar-core,build-web-demo"/>
@@ -63,6 +65,7 @@
<lib file="${queries.jar}"/>
<lib file="${queryparser.jar}"/>
<lib file="${lucene-core.jar}"/>
+ <lib file="${facet.jar}"/>
</war>
</target>
Copied: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/ExampleResult.java (from r1440418, lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/ExampleResult.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/ExampleResult.java?p2=lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/ExampleResult.java&p1=lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/ExampleResult.java&r1=1440418&r2=1440578&rev=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/ExampleResult.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/ExampleResult.java Wed Jan 30 18:31:07 2013
@@ -1,4 +1,4 @@
-package org.apache.lucene.facet.example;
+package org.apache.lucene.demo.facet;
import java.util.List;
Copied: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/ExampleUtils.java (from r1440418, lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/ExampleUtils.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/ExampleUtils.java?p2=lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/ExampleUtils.java&p1=lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/ExampleUtils.java&r1=1440418&r2=1440578&rev=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/ExampleUtils.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/ExampleUtils.java Wed Jan 30 18:31:07 2013
@@ -1,4 +1,4 @@
-package org.apache.lucene.facet.example;
+package org.apache.lucene.demo.facet;
import org.apache.lucene.util.Version;
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/AdaptiveMain.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/AdaptiveMain.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/AdaptiveMain.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/AdaptiveMain.java Wed Jan 30 18:31:07 2013
@@ -1,14 +1,14 @@
-package org.apache.lucene.facet.example.adaptive;
+package org.apache.lucene.demo.facet.adaptive;
import java.util.List;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.facet.example.ExampleResult;
-import org.apache.lucene.facet.example.ExampleUtils;
-import org.apache.lucene.facet.example.simple.SimpleIndexer;
-import org.apache.lucene.facet.example.simple.SimpleSearcher;
+import org.apache.lucene.demo.facet.ExampleResult;
+import org.apache.lucene.demo.facet.ExampleUtils;
+import org.apache.lucene.demo.facet.simple.SimpleIndexer;
+import org.apache.lucene.demo.facet.simple.SimpleSearcher;
import org.apache.lucene.facet.search.AdaptiveFacetsAccumulator;
import org.apache.lucene.facet.search.results.FacetResult;
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/AdaptiveSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/AdaptiveSearcher.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/AdaptiveSearcher.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/AdaptiveSearcher.java Wed Jan 30 18:31:07 2013
@@ -1,9 +1,9 @@
-package org.apache.lucene.facet.example.adaptive;
+package org.apache.lucene.demo.facet.adaptive;
import java.util.List;
-import org.apache.lucene.facet.example.ExampleUtils;
-import org.apache.lucene.facet.example.simple.SimpleUtils;
+import org.apache.lucene.demo.facet.ExampleUtils;
+import org.apache.lucene.demo.facet.simple.SimpleUtils;
import org.apache.lucene.facet.search.AdaptiveFacetsAccumulator;
import org.apache.lucene.facet.search.ScoredDocIdCollector;
import org.apache.lucene.facet.search.params.CountFacetRequest;
Added: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/package.html?rev=1440578&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/package.html (added)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/adaptive/package.html Wed Jan 30 18:31:07 2013
@@ -0,0 +1,22 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html><head></head>
+<body>
+Facets example code for using AdaptiveFacetsAccumulator.
+</body>
+</html>
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsIndexer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsIndexer.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsIndexer.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsIndexer.java Wed Jan 30 18:31:07 2013
@@ -1,13 +1,13 @@
-package org.apache.lucene.facet.example.association;
+package org.apache.lucene.demo.facet.association;
+import org.apache.lucene.demo.facet.ExampleUtils;
+import org.apache.lucene.demo.facet.simple.SimpleUtils;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
import org.apache.lucene.facet.associations.AssociationsFacetFields;
import org.apache.lucene.facet.associations.CategoryAssociation;
import org.apache.lucene.facet.associations.CategoryAssociationsContainer;
-import org.apache.lucene.facet.example.ExampleUtils;
-import org.apache.lucene.facet.example.simple.SimpleUtils;
import org.apache.lucene.facet.taxonomy.CategoryPath;
import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsMain.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsMain.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsMain.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsMain.java Wed Jan 30 18:31:07 2013
@@ -1,12 +1,12 @@
-package org.apache.lucene.facet.example.association;
+package org.apache.lucene.demo.facet.association;
import java.util.List;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.facet.example.ExampleResult;
-import org.apache.lucene.facet.example.ExampleUtils;
+import org.apache.lucene.demo.facet.ExampleResult;
+import org.apache.lucene.demo.facet.ExampleUtils;
import org.apache.lucene.facet.search.results.FacetResult;
/*
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsSearcher.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsSearcher.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsSearcher.java Wed Jan 30 18:31:07 2013
@@ -1,4 +1,4 @@
-package org.apache.lucene.facet.example.association;
+package org.apache.lucene.demo.facet.association;
import java.util.List;
@@ -6,7 +6,7 @@ import org.apache.lucene.index.Directory
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.facet.example.simple.SimpleSearcher;
+import org.apache.lucene.demo.facet.simple.SimpleSearcher;
import org.apache.lucene.facet.search.params.associations.AssociationFloatSumFacetRequest;
import org.apache.lucene.facet.search.params.associations.AssociationIntSumFacetRequest;
import org.apache.lucene.facet.search.results.FacetResult;
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsUtils.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsUtils.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/CategoryAssociationsUtils.java Wed Jan 30 18:31:07 2013
@@ -1,4 +1,4 @@
-package org.apache.lucene.facet.example.association;
+package org.apache.lucene.demo.facet.association;
import org.apache.lucene.facet.associations.CategoryAssociation;
import org.apache.lucene.facet.associations.CategoryFloatAssociation;
Added: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/package.html?rev=1440578&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/package.html (added)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/association/package.html Wed Jan 30 18:31:07 2013
@@ -0,0 +1,22 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html><head></head>
+<body>
+Facets example code for using associations.
+</body>
+</html>
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLIndexer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLIndexer.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLIndexer.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLIndexer.java Wed Jan 30 18:31:07 2013
@@ -1,4 +1,4 @@
-package org.apache.lucene.facet.example.multiCL;
+package org.apache.lucene.demo.facet.multiCL;
import java.util.Arrays;
import java.util.HashMap;
@@ -6,11 +6,11 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
+import org.apache.lucene.demo.facet.ExampleUtils;
+import org.apache.lucene.demo.facet.simple.SimpleUtils;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.facet.example.ExampleUtils;
-import org.apache.lucene.facet.example.simple.SimpleUtils;
import org.apache.lucene.facet.index.FacetFields;
import org.apache.lucene.facet.index.params.CategoryListParams;
import org.apache.lucene.facet.index.params.FacetIndexingParams;
@@ -90,12 +90,16 @@ public class MultiCLIndexer {
/**
* Create an index, and adds to it sample documents and facets.
- * @param indexDir Directory in which the index should be created.
- * @param taxoDir Directory in which the taxonomy index should be created.
- * @throws Exception on error (no detailed exception handling here for sample simplicity
+ *
+ * @param indexDir
+ * Directory in which the index should be created.
+ * @param taxoDir
+ * Directory in which the taxonomy index should be created.
+ * @throws Exception
+ * on error (no detailed exception handling here for sample
+ * simplicity
*/
- public static void index(Directory indexDir, Directory taxoDir)
- throws Exception {
+ public static void index(Directory indexDir, Directory taxoDir) throws Exception {
Random random = new Random(2003);
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLMain.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLMain.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLMain.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLMain.java Wed Jan 30 18:31:07 2013
@@ -1,12 +1,12 @@
-package org.apache.lucene.facet.example.multiCL;
+package org.apache.lucene.demo.facet.multiCL;
import java.util.List;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.facet.example.ExampleResult;
-import org.apache.lucene.facet.example.ExampleUtils;
+import org.apache.lucene.demo.facet.ExampleResult;
+import org.apache.lucene.demo.facet.ExampleUtils;
import org.apache.lucene.facet.search.results.FacetResult;
/*
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLSearcher.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLSearcher.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/MultiCLSearcher.java Wed Jan 30 18:31:07 2013
@@ -1,4 +1,4 @@
-package org.apache.lucene.facet.example.multiCL;
+package org.apache.lucene.demo.facet.multiCL;
import java.util.ArrayList;
import java.util.List;
@@ -13,8 +13,8 @@ import org.apache.lucene.search.TopScore
import org.apache.lucene.store.Directory;
import org.apache.lucene.search.MultiCollector;
-import org.apache.lucene.facet.example.ExampleUtils;
-import org.apache.lucene.facet.example.simple.SimpleUtils;
+import org.apache.lucene.demo.facet.ExampleUtils;
+import org.apache.lucene.demo.facet.simple.SimpleUtils;
import org.apache.lucene.facet.index.params.FacetIndexingParams;
import org.apache.lucene.facet.search.FacetsCollector;
import org.apache.lucene.facet.search.params.CountFacetRequest;
Added: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/package.html?rev=1440578&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/package.html (added)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/multiCL/package.html Wed Jan 30 18:31:07 2013
@@ -0,0 +1,22 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html><head></head>
+<body>
+Facets example code for using multiple category lists.
+</body>
+</html>
Added: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/package.html?rev=1440578&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/package.html (added)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/package.html Wed Jan 30 18:31:07 2013
@@ -0,0 +1,22 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html><head></head>
+<body>
+Facets example code.
+</body>
+</html>
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleIndexer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleIndexer.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleIndexer.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleIndexer.java Wed Jan 30 18:31:07 2013
@@ -1,12 +1,12 @@
-package org.apache.lucene.facet.example.simple;
+package org.apache.lucene.demo.facet.simple;
import java.util.Arrays;
import java.util.List;
+import org.apache.lucene.demo.facet.ExampleUtils;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.facet.example.ExampleUtils;
import org.apache.lucene.facet.index.FacetFields;
import org.apache.lucene.facet.taxonomy.CategoryPath;
import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleMain.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleMain.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleMain.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleMain.java Wed Jan 30 18:31:07 2013
@@ -1,4 +1,4 @@
-package org.apache.lucene.facet.example.simple;
+package org.apache.lucene.demo.facet.simple;
import java.util.List;
@@ -7,8 +7,8 @@ import org.apache.lucene.index.IndexRead
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.facet.example.ExampleResult;
-import org.apache.lucene.facet.example.ExampleUtils;
+import org.apache.lucene.demo.facet.ExampleResult;
+import org.apache.lucene.demo.facet.ExampleUtils;
import org.apache.lucene.facet.search.results.FacetResult;
import org.apache.lucene.facet.taxonomy.TaxonomyReader;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleSearcher.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleSearcher.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleSearcher.java Wed Jan 30 18:31:07 2013
@@ -1,9 +1,9 @@
-package org.apache.lucene.facet.example.simple;
+package org.apache.lucene.demo.facet.simple;
import java.util.Iterator;
import java.util.List;
-import org.apache.lucene.facet.example.ExampleUtils;
+import org.apache.lucene.demo.facet.ExampleUtils;
import org.apache.lucene.facet.index.params.FacetIndexingParams;
import org.apache.lucene.facet.search.DrillDown;
import org.apache.lucene.facet.search.FacetsCollector;
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleUtils.java?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleUtils.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/SimpleUtils.java Wed Jan 30 18:31:07 2013
@@ -1,8 +1,8 @@
-package org.apache.lucene.facet.example.simple;
+package org.apache.lucene.demo.facet.simple;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
-import org.apache.lucene.facet.example.ExampleUtils;
+import org.apache.lucene.demo.facet.ExampleUtils;
import org.apache.lucene.facet.taxonomy.CategoryPath;
/*
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/package.html?rev=1440578&r1=1440418&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/package.html (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/simple/package.html Wed Jan 30 18:31:07 2013
@@ -1,17 +1,22 @@
-<html>
- <head>
- <title>Simple faceted indexing and search sample</title>
- </head>
- <body>
- <h1>Simple faceted indexing and search sample</h1>
-
- A simple faceted example, showing how to:
- <ol>
- <li>Create an index.</li>
- <li>Add documents with facets to the index.</li>
- <li>Search the index.</li>
- </ol>
-
- For more complex examples see the other sample code packages.
- </body>
-</html>
\ No newline at end of file
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html><head></head>
+<body>
+Facets simple example code.
+</body>
+</html>
Copied: lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestAdaptiveExample.java (from r1440418, lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestAdaptiveExample.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestAdaptiveExample.java?p2=lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestAdaptiveExample.java&p1=lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestAdaptiveExample.java&r1=1440418&r2=1440578&rev=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestAdaptiveExample.java (original)
+++ lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestAdaptiveExample.java Wed Jan 30 18:31:07 2013
@@ -1,10 +1,10 @@
-package org.apache.lucene.facet.example;
+package org.apache.lucene.demo.facet;
import org.junit.Test;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.facet.example.ExampleResult;
-import org.apache.lucene.facet.example.adaptive.AdaptiveMain;
+import org.apache.lucene.demo.facet.ExampleResult;
+import org.apache.lucene.demo.facet.adaptive.AdaptiveMain;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
Copied: lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestAssociationExample.java (from r1440418, lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestAssociationExample.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestAssociationExample.java?p2=lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestAssociationExample.java&p1=lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestAssociationExample.java&r1=1440418&r2=1440578&rev=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestAssociationExample.java (original)
+++ lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestAssociationExample.java Wed Jan 30 18:31:07 2013
@@ -1,10 +1,10 @@
-package org.apache.lucene.facet.example;
+package org.apache.lucene.demo.facet;
import org.junit.Test;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.facet.example.ExampleResult;
-import org.apache.lucene.facet.example.association.CategoryAssociationsMain;
+import org.apache.lucene.demo.facet.ExampleResult;
+import org.apache.lucene.demo.facet.association.CategoryAssociationsMain;
import org.apache.lucene.facet.search.results.FacetResultNode;
/*
Copied: lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestMultiCLExample.java (from r1440418, lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestMultiCLExample.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestMultiCLExample.java?p2=lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestMultiCLExample.java&p1=lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestMultiCLExample.java&r1=1440418&r2=1440578&rev=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestMultiCLExample.java (original)
+++ lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestMultiCLExample.java Wed Jan 30 18:31:07 2013
@@ -1,4 +1,4 @@
-package org.apache.lucene.facet.example;
+package org.apache.lucene.demo.facet;
import java.util.Iterator;
import java.util.List;
@@ -6,7 +6,8 @@ import java.util.List;
import org.junit.Test;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.facet.example.multiCL.MultiCLMain;
+import org.apache.lucene.demo.facet.ExampleResult;
+import org.apache.lucene.demo.facet.multiCL.MultiCLMain;
import org.apache.lucene.facet.search.results.FacetResult;
import org.apache.lucene.facet.search.results.FacetResultNode;
Copied: lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestSimpleExample.java (from r1440418, lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestSimpleExample.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestSimpleExample.java?p2=lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestSimpleExample.java&p1=lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestSimpleExample.java&r1=1440418&r2=1440578&rev=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/example/TestSimpleExample.java (original)
+++ lucene/dev/trunk/lucene/demo/src/test/org/apache/lucene/demo/facet/TestSimpleExample.java Wed Jan 30 18:31:07 2013
@@ -1,12 +1,12 @@
-package org.apache.lucene.facet.example;
+package org.apache.lucene.demo.facet;
import java.util.Iterator;
import org.junit.Test;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.facet.example.ExampleResult;
-import org.apache.lucene.facet.example.simple.SimpleMain;
+import org.apache.lucene.demo.facet.ExampleResult;
+import org.apache.lucene.demo.facet.simple.SimpleMain;
import org.apache.lucene.facet.search.results.FacetResult;
import org.apache.lucene.facet.search.results.FacetResultNode;
Modified: lucene/dev/trunk/lucene/facet/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/build.xml?rev=1440578&r1=1440577&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/build.xml (original)
+++ lucene/dev/trunk/lucene/facet/build.xml Wed Jan 30 18:31:07 2013
@@ -28,52 +28,6 @@
<import file="../module-build.xml"/>
- <property name="examples.dir" location="src/examples"/>
-
- <path id="examples.classpath">
- <path refid="classpath" />
- <pathelement location="${build.dir}/classes/java" />
- <pathelement path="${analyzers-common.jar}" />
- </path>
-
- <path id="test.classpath">
- <path refid="test.base.classpath" />
- <pathelement location="${build.dir}/classes/examples" />
- </path>
-
- <path id="classpath">
- <!-- TODO, cut over tests to MockAnalyzer etc and nuke this dependency -->
- <pathelement path="${analyzers-common.jar}" />
- <path refid="base.classpath"/>
- </path>
-
- <target name="compile-examples" description="Compiles Facets examples">
- <compile srcdir="${examples.dir}" destdir="${build.dir}/classes/examples">
- <classpath refid="examples.classpath" />
- </compile>
- </target>
-
- <target name="jar-examples" depends="compile-examples">
- <jarify basedir="${build.dir}/classes/examples"
- destfile="${build.dir}/${final.name}-examples.jar"
- title="Lucene Search Engine: ${ant.project.name}-examples"
- manifest.file="${build.dir}/EXAMPLES-MANIFEST.MF">
- <fileset dir="src/examples" />
- </jarify>
- </target>
-
- <target name="compile-core" depends="jar-analyzers-common,common.compile-core,compile-examples" description="Compiles facet classes" />
-
- <target name="jar-core" depends="common.jar-core,jar-examples" />
-
- <target name="javadocs" depends="javadocs-analyzers-common,compile-core">
- <invoke-module-javadoc>
- <links>
- <link href="../analyzers-common"/>
- </links>
- </invoke-module-javadoc>
- </target>
-
<target name="run-encoding-benchmark" depends="compile-test">
<java classname="org.apache.lucene.util.encoding.EncodingSpeed" fork="true" failonerror="true">
<classpath refid="test.classpath" />
Copied: lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/util/TaxonomyMergeUtils.java (from r1440418, lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/util/TaxonomyMergeUtils.java?p2=lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/util/TaxonomyMergeUtils.java&p1=lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java&r1=1440418&r2=1440578&rev=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/examples/org/apache/lucene/facet/example/merge/TaxonomyMergeUtils.java (original)
+++ lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/util/TaxonomyMergeUtils.java Wed Jan 30 18:31:07 2013
@@ -1,9 +1,8 @@
-package org.apache.lucene.facet.example.merge;
+package org.apache.lucene.facet.util;
import java.io.IOException;
import java.util.List;
-import org.apache.lucene.facet.example.ExampleUtils;
import org.apache.lucene.facet.index.OrdinalMappingAtomicReader;
import org.apache.lucene.facet.index.params.FacetIndexingParams;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
@@ -17,6 +16,7 @@ import org.apache.lucene.index.IndexWrit
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.MultiReader;
import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.Version;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -52,8 +52,7 @@ public class TaxonomyMergeUtils {
*/
public static void merge(Directory srcIndexDir, Directory srcTaxDir, Directory destIndexDir, Directory destTaxDir,
FacetIndexingParams params) throws IOException {
- IndexWriter destIndexWriter = new IndexWriter(destIndexDir,
- new IndexWriterConfig(ExampleUtils.EXAMPLE_VER, null));
+ IndexWriter destIndexWriter = new IndexWriter(destIndexDir, new IndexWriterConfig(Version.LUCENE_42, null));
DirectoryTaxonomyWriter destTaxWriter = new DirectoryTaxonomyWriter(destTaxDir);
merge(srcIndexDir, srcTaxDir, new MemoryOrdinalMap(), destIndexWriter, destTaxWriter, params);
destTaxWriter.close();
Modified: lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java?rev=1440578&r1=1440577&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java (original)
+++ lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/FacetTestUtils.java Wed Jan 30 18:31:07 2013
@@ -1,19 +1,7 @@
package org.apache.lucene.facet;
-import java.io.IOException;
-
-import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.facet.search.results.FacetResult;
import org.apache.lucene.facet.search.results.FacetResultNode;
-import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
-import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
-import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
-import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.util.LuceneTestCase;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -34,68 +22,6 @@ import org.apache.lucene.util.LuceneTest
public class FacetTestUtils {
- public static class IndexTaxonomyReaderPair {
- public DirectoryReader indexReader;
- public DirectoryTaxonomyReader taxReader;
- public IndexSearcher indexSearcher;
-
- public void close() throws IOException {
- indexReader.close();
- taxReader.close();
- }
-
- }
-
- public static class IndexTaxonomyWriterPair {
- public IndexWriter indexWriter;
- public TaxonomyWriter taxWriter;
-
- public void close() throws IOException {
- indexWriter.close();
- taxWriter.close();
- }
-
- public void commit() throws IOException {
- indexWriter.commit();
- taxWriter.commit();
- }
- }
-
- public static Directory[][] createIndexTaxonomyDirs(int number) {
- Directory[][] dirs = new Directory[number][2];
- for (int i = 0; i < number; i++) {
- dirs[i][0] = LuceneTestCase.newDirectory();
- dirs[i][1] = LuceneTestCase.newDirectory();
- }
- return dirs;
- }
-
- public static IndexTaxonomyReaderPair[] createIndexTaxonomyReaderPair(Directory[][] dirs) throws IOException {
- IndexTaxonomyReaderPair[] pairs = new IndexTaxonomyReaderPair[dirs.length];
- for (int i = 0; i < dirs.length; i++) {
- IndexTaxonomyReaderPair pair = new IndexTaxonomyReaderPair();
- pair.indexReader = DirectoryReader.open(dirs[i][0]);
- pair.indexSearcher = new IndexSearcher(pair.indexReader);
- pair.taxReader = new DirectoryTaxonomyReader(dirs[i][1]);
- pairs[i] = pair;
- }
- return pairs;
- }
-
- public static IndexTaxonomyWriterPair[] createIndexTaxonomyWriterPair(Directory[][] dirs) throws IOException {
- IndexTaxonomyWriterPair[] pairs = new IndexTaxonomyWriterPair[dirs.length];
- for (int i = 0; i < dirs.length; i++) {
- IndexTaxonomyWriterPair pair = new IndexTaxonomyWriterPair();
- pair.indexWriter = new IndexWriter(dirs[i][0], new IndexWriterConfig(
- LuceneTestCase.TEST_VERSION_CURRENT, new MockAnalyzer(LuceneTestCase.random())));
- pair.taxWriter = new DirectoryTaxonomyWriter(dirs[i][1]);
- pair.indexWriter.commit();
- pair.taxWriter.commit();
- pairs[i] = pair;
- }
- return pairs;
- }
-
public static String toSimpleString(FacetResult fr) {
StringBuilder sb = new StringBuilder();
toSimpleString(0, sb, fr.getFacetResultNode(), "");
Modified: lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/index/OrdinalMappingReaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/index/OrdinalMappingReaderTest.java?rev=1440578&r1=1440577&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/index/OrdinalMappingReaderTest.java (original)
+++ lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/index/OrdinalMappingReaderTest.java Wed Jan 30 18:31:07 2013
@@ -8,7 +8,6 @@ import org.apache.lucene.analysis.MockAn
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.document.Document;
import org.apache.lucene.facet.FacetTestCase;
-import org.apache.lucene.facet.example.merge.TaxonomyMergeUtils;
import org.apache.lucene.facet.index.params.FacetIndexingParams;
import org.apache.lucene.facet.search.FacetsCollector;
import org.apache.lucene.facet.search.params.CountFacetRequest;
@@ -18,6 +17,7 @@ import org.apache.lucene.facet.search.re
import org.apache.lucene.facet.taxonomy.CategoryPath;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
+import org.apache.lucene.facet.util.TaxonomyMergeUtils;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
Modified: lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java?rev=1440578&r1=1440577&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java (original)
+++ lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestMultipleCategoryLists.java Wed Jan 30 18:31:07 2013
@@ -14,7 +14,6 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
import org.apache.lucene.facet.FacetTestCase;
-import org.apache.lucene.facet.FacetTestUtils;
import org.apache.lucene.facet.index.FacetFields;
import org.apache.lucene.facet.index.params.CategoryListParams;
import org.apache.lucene.facet.index.params.FacetIndexingParams;
@@ -77,12 +76,14 @@ public class TestMultipleCategoryLists e
@Test
public void testDefault() throws Exception {
- Directory[][] dirs = getDirs();
+ Directory indexDir = newDirectory();
+ Directory taxoDir = newDirectory();
+
// create and open an index writer
- RandomIndexWriter iw = new RandomIndexWriter(random(), dirs[0][0], newIndexWriterConfig(
+ RandomIndexWriter iw = new RandomIndexWriter(random(), indexDir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false)));
// create and open a taxonomy writer
- TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1], OpenMode.CREATE);
+ TaxonomyWriter tw = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE);
PerDimensionIndexingParams iParams = new PerDimensionIndexingParams(Collections.<CategoryPath, CategoryListParams>emptyMap());
@@ -92,7 +93,7 @@ public class TestMultipleCategoryLists e
tw.commit();
// prepare index reader and taxonomy.
- TaxonomyReader tr = new DirectoryTaxonomyReader(dirs[0][1]);
+ TaxonomyReader tr = new DirectoryTaxonomyReader(taxoDir);
// prepare searcher to search against
IndexSearcher searcher = newSearcher(ir);
@@ -105,17 +106,19 @@ public class TestMultipleCategoryLists e
assertOrdinalsExist("$facets", ir);
IOUtils.close(tr, ir, iw, tw);
- IOUtils.close(dirs[0]);
+ IOUtils.close(indexDir, taxoDir);
}
@Test
public void testCustom() throws Exception {
- Directory[][] dirs = getDirs();
+ Directory indexDir = newDirectory();
+ Directory taxoDir = newDirectory();
+
// create and open an index writer
- RandomIndexWriter iw = new RandomIndexWriter(random(), dirs[0][0], newIndexWriterConfig(
+ RandomIndexWriter iw = new RandomIndexWriter(random(), indexDir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false)));
// create and open a taxonomy writer
- TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1], OpenMode.CREATE);
+ TaxonomyWriter tw = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE);
PerDimensionIndexingParams iParams = new PerDimensionIndexingParams(
Collections.singletonMap(new CategoryPath("Author"), new CategoryListParams("$author")));
@@ -125,7 +128,7 @@ public class TestMultipleCategoryLists e
tw.commit();
// prepare index reader and taxonomy.
- TaxonomyReader tr = new DirectoryTaxonomyReader(dirs[0][1]);
+ TaxonomyReader tr = new DirectoryTaxonomyReader(taxoDir);
// prepare searcher to search against
IndexSearcher searcher = newSearcher(ir);
@@ -139,17 +142,19 @@ public class TestMultipleCategoryLists e
assertOrdinalsExist("$author", ir);
IOUtils.close(tr, ir, iw, tw);
- IOUtils.close(dirs[0]);
+ IOUtils.close(indexDir, taxoDir);
}
@Test
public void testTwoCustomsSameField() throws Exception {
- Directory[][] dirs = getDirs();
+ Directory indexDir = newDirectory();
+ Directory taxoDir = newDirectory();
+
// create and open an index writer
- RandomIndexWriter iw = new RandomIndexWriter(random(), dirs[0][0], newIndexWriterConfig(
+ RandomIndexWriter iw = new RandomIndexWriter(random(), indexDir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false)));
// create and open a taxonomy writer
- TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1], OpenMode.CREATE);
+ TaxonomyWriter tw = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE);
Map<CategoryPath,CategoryListParams> paramsMap = new HashMap<CategoryPath,CategoryListParams>();
paramsMap.put(new CategoryPath("Band"), new CategoryListParams("$music"));
@@ -161,7 +166,7 @@ public class TestMultipleCategoryLists e
tw.commit();
// prepare index reader and taxonomy.
- TaxonomyReader tr = new DirectoryTaxonomyReader(dirs[0][1]);
+ TaxonomyReader tr = new DirectoryTaxonomyReader(taxoDir);
// prepare searcher to search against
IndexSearcher searcher = newSearcher(ir);
@@ -176,7 +181,7 @@ public class TestMultipleCategoryLists e
assertOrdinalsExist("$music", ir);
IOUtils.close(tr, ir, iw, tw);
- IOUtils.close(dirs[0]);
+ IOUtils.close(indexDir, taxoDir);
}
private void assertOrdinalsExist(String field, IndexReader ir) throws IOException {
@@ -191,12 +196,14 @@ public class TestMultipleCategoryLists e
@Test
public void testDifferentFieldsAndText() throws Exception {
- Directory[][] dirs = getDirs();
+ Directory indexDir = newDirectory();
+ Directory taxoDir = newDirectory();
+
// create and open an index writer
- RandomIndexWriter iw = new RandomIndexWriter(random(), dirs[0][0], newIndexWriterConfig(
+ RandomIndexWriter iw = new RandomIndexWriter(random(), indexDir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false)));
// create and open a taxonomy writer
- TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1], OpenMode.CREATE);
+ TaxonomyWriter tw = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE);
Map<CategoryPath,CategoryListParams> paramsMap = new HashMap<CategoryPath,CategoryListParams>();
paramsMap.put(new CategoryPath("Band"), new CategoryListParams("$bands"));
@@ -208,7 +215,7 @@ public class TestMultipleCategoryLists e
tw.commit();
// prepare index reader and taxonomy.
- TaxonomyReader tr = new DirectoryTaxonomyReader(dirs[0][1]);
+ TaxonomyReader tr = new DirectoryTaxonomyReader(taxoDir);
// prepare searcher to search against
IndexSearcher searcher = newSearcher(ir);
@@ -222,17 +229,19 @@ public class TestMultipleCategoryLists e
assertOrdinalsExist("$composers", ir);
IOUtils.close(tr, ir, iw, tw);
- IOUtils.close(dirs[0]);
+ IOUtils.close(indexDir, taxoDir);
}
@Test
public void testSomeSameSomeDifferent() throws Exception {
- Directory[][] dirs = getDirs();
+ Directory indexDir = newDirectory();
+ Directory taxoDir = newDirectory();
+
// create and open an index writer
- RandomIndexWriter iw = new RandomIndexWriter(random(), dirs[0][0], newIndexWriterConfig(
+ RandomIndexWriter iw = new RandomIndexWriter(random(), indexDir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false)));
// create and open a taxonomy writer
- TaxonomyWriter tw = new DirectoryTaxonomyWriter(dirs[0][1], OpenMode.CREATE);
+ TaxonomyWriter tw = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE);
Map<CategoryPath,CategoryListParams> paramsMap = new HashMap<CategoryPath,CategoryListParams>();
paramsMap.put(new CategoryPath("Band"), new CategoryListParams("$music"));
@@ -246,7 +255,7 @@ public class TestMultipleCategoryLists e
tw.commit();
// prepare index reader and taxonomy.
- TaxonomyReader tr = new DirectoryTaxonomyReader(dirs[0][1]);
+ TaxonomyReader tr = new DirectoryTaxonomyReader(taxoDir);
// prepare searcher to search against
IndexSearcher searcher = newSearcher(ir);
@@ -259,11 +268,7 @@ public class TestMultipleCategoryLists e
assertOrdinalsExist("$literature", ir);
IOUtils.close(tr, ir, iw, tw);
- IOUtils.close(dirs[0]);
- }
-
- private Directory[][] getDirs() {
- return FacetTestUtils.createIndexTaxonomyDirs(1);
+ IOUtils.close(indexDir, taxoDir);
}
private void assertCorrectResults(FacetsCollector facetsCollector) throws IOException {
Modified: lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCounts.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCounts.java?rev=1440578&r1=1440577&r2=1440578&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCounts.java (original)
+++ lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/search/TestTotalFacetCounts.java Wed Jan 30 18:31:07 2013
@@ -3,14 +3,20 @@ package org.apache.lucene.facet.search;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
+import java.util.Collections;
+import org.apache.lucene.document.Document;
import org.apache.lucene.facet.FacetTestCase;
-import org.apache.lucene.facet.FacetTestUtils;
-import org.apache.lucene.facet.FacetTestUtils.IndexTaxonomyReaderPair;
-import org.apache.lucene.facet.FacetTestUtils.IndexTaxonomyWriterPair;
+import org.apache.lucene.facet.index.FacetFields;
import org.apache.lucene.facet.index.params.CategoryListParams;
import org.apache.lucene.facet.index.params.FacetIndexingParams;
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.directory.DirectoryTaxonomyReader;
+import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter;
+import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util._TestUtil;
@@ -35,9 +41,9 @@ import org.junit.Test;
public class TestTotalFacetCounts extends FacetTestCase {
- private static void initCache(int numEntries) {
+ private static void initCache() {
TotalFacetCountsCache.getSingleton().clear();
- TotalFacetCountsCache.getSingleton().setCacheSize(numEntries); // Set to keep one in mem
+ TotalFacetCountsCache.getSingleton().setCacheSize(1); // Set to keep one in mem
}
@Test
@@ -50,12 +56,13 @@ public class TestTotalFacetCounts extend
}
private void doTestWriteRead(final int partitionSize) throws IOException {
- initCache(1);
+ initCache();
- // Create temporary RAMDirectories
- Directory[][] dirs = FacetTestUtils.createIndexTaxonomyDirs(1);
- // Create our index/taxonomy writers
- IndexTaxonomyWriterPair[] writers = FacetTestUtils.createIndexTaxonomyWriterPair(dirs);
+ Directory indexDir = newDirectory();
+ Directory taxoDir = newDirectory();
+ IndexWriter indexWriter = new IndexWriter(indexDir, newIndexWriterConfig(TEST_VERSION_CURRENT, null));
+ TaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir);
+
FacetIndexingParams iParams = new FacetIndexingParams() {
@Override
public int getPartitionSize() {
@@ -75,36 +82,34 @@ public class TestTotalFacetCounts extend
// The counts that the TotalFacetCountsArray should have after adding
// the below facets to the index.
int[] expectedCounts = new int[] { 0, 3, 1, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1 };
-
- // Add a facet to the index
- TestTotalFacetCountsCache.addFacets(iParams, writers[0].indexWriter, writers[0].taxWriter, "a", "b");
- TestTotalFacetCountsCache.addFacets(iParams, writers[0].indexWriter, writers[0].taxWriter, "c", "d");
- TestTotalFacetCountsCache.addFacets(iParams, writers[0].indexWriter, writers[0].taxWriter, "a", "e");
- TestTotalFacetCountsCache.addFacets(iParams, writers[0].indexWriter, writers[0].taxWriter, "a", "d");
- TestTotalFacetCountsCache.addFacets(iParams, writers[0].indexWriter, writers[0].taxWriter, "c", "g");
- TestTotalFacetCountsCache.addFacets(iParams, writers[0].indexWriter, writers[0].taxWriter, "c", "z");
- TestTotalFacetCountsCache.addFacets(iParams, writers[0].indexWriter, writers[0].taxWriter, "b", "a");
- TestTotalFacetCountsCache.addFacets(iParams, writers[0].indexWriter, writers[0].taxWriter, "1", "2");
- TestTotalFacetCountsCache.addFacets(iParams, writers[0].indexWriter, writers[0].taxWriter, "b", "c");
+ String[] categories = new String[] { "a/b", "c/d", "a/e", "a/d", "c/g", "c/z", "b/a", "1/2", "b/c" };
+
+ FacetFields facetFields = new FacetFields(taxoWriter, iParams);
+ for (String cat : categories) {
+ Document doc = new Document();
+ facetFields.addFields(doc, Collections.singletonList(new CategoryPath(cat, '/')));
+ indexWriter.addDocument(doc);
+ }
// Commit Changes
- writers[0].close();
+ IOUtils.close(indexWriter, taxoWriter);
- IndexTaxonomyReaderPair[] readers = FacetTestUtils.createIndexTaxonomyReaderPair(dirs);
+ DirectoryReader indexReader = DirectoryReader.open(indexDir);
+ TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir);
int[] intArray = new int[iParams.getPartitionSize()];
TotalFacetCountsCache tfcc = TotalFacetCountsCache.getSingleton();
File tmpFile = _TestUtil.createTempFile("test", "tmp", TEMP_DIR);
- tfcc.store(tmpFile, readers[0].indexReader, readers[0].taxReader, iParams);
+ tfcc.store(tmpFile, indexReader, taxoReader, iParams);
tfcc.clear(); // not really required because TFCC overrides on load(), but in the test we need not rely on this.
- tfcc.load(tmpFile, readers[0].indexReader, readers[0].taxReader, iParams);
+ tfcc.load(tmpFile, indexReader, taxoReader, iParams);
// now retrieve the one just loaded
- TotalFacetCounts totalCounts = tfcc.getTotalCounts(readers[0].indexReader, readers[0].taxReader, iParams);
+ TotalFacetCounts totalCounts = tfcc.getTotalCounts(indexReader, taxoReader, iParams);
int partition = 0;
- for (int i=0; i<expectedCounts.length; i+=partitionSize) {
+ for (int i = 0; i < expectedCounts.length; i += partitionSize) {
totalCounts.fillTotalCountsForPartition(intArray, partition);
int[] partitionExpectedCounts = new int[partitionSize];
int nToCopy = Math.min(partitionSize,expectedCounts.length-i);
@@ -115,8 +120,8 @@ public class TestTotalFacetCounts extend
Arrays.equals(partitionExpectedCounts, intArray));
++partition;
}
- readers[0].close();
- IOUtils.close(dirs[0]);
+ IOUtils.close(indexReader, taxoReader);
+ IOUtils.close(indexDir, taxoDir);
tmpFile.delete();
}