lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sh...@apache.org
Subject svn commit: r1628413 - in /lucene/dev/branches/branch_5x/lucene/demo: ./ src/java/org/apache/lucene/demo/facet/
Date Tue, 30 Sep 2014 12:11:14 GMT
Author: shaie
Date: Tue Sep 30 12:11:13 2014
New Revision: 1628413

URL: http://svn.apache.org/r1628413
Log:
create all indexes w/ OpenMode.CREATE in facet demos

Modified:
    lucene/dev/branches/branch_5x/lucene/demo/   (props changed)
    lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/AssociationsFacetsExample.java
    lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/DistanceFacetsExample.java
    lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/ExpressionAggregationFacetsExample.java
    lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/MultiCategoryListsFacetsExample.java
    lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/RangeFacetsExample.java
    lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleFacetsExample.java
    lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleSortedSetFacetsExample.java

Modified: lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/AssociationsFacetsExample.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/AssociationsFacetsExample.java?rev=1628413&r1=1628412&r2=1628413&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/AssociationsFacetsExample.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/AssociationsFacetsExample.java
Tue Sep 30 12:11:13 2014
@@ -38,6 +38,7 @@ import org.apache.lucene.facet.taxonomy.
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.store.Directory;
@@ -61,7 +62,7 @@ public class AssociationsFacetsExample {
   
   /** Build the example index. */
   private void index() throws IOException {
-    IndexWriterConfig iwc = new IndexWriterConfig(new WhitespaceAnalyzer());
+    IndexWriterConfig iwc = new IndexWriterConfig(new WhitespaceAnalyzer()).setOpenMode(OpenMode.CREATE);
     IndexWriter indexWriter = new IndexWriter(indexDir, iwc);
 
     // Writes facet ords to a separate directory from the main index

Modified: lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/DistanceFacetsExample.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/DistanceFacetsExample.java?rev=1628413&r1=1628412&r2=1628413&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/DistanceFacetsExample.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/DistanceFacetsExample.java
Tue Sep 30 12:11:13 2014
@@ -41,6 +41,7 @@ import org.apache.lucene.facet.taxonomy.
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.queries.BooleanFilter;
 import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.BooleanClause;
@@ -54,8 +55,6 @@ import org.apache.lucene.store.Directory
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.SloppyMath;
 
-
-
 /** Shows simple usage of dynamic range faceting, using the
  *  expressions module to calculate distance. */
 public class DistanceFacetsExample implements Closeable {
@@ -88,7 +87,7 @@ public class DistanceFacetsExample imple
   /** Build the example index. */
   public void index() throws IOException {
     IndexWriter writer = new IndexWriter(indexDir, new IndexWriterConfig(
-        new WhitespaceAnalyzer()));
+        new WhitespaceAnalyzer()).setOpenMode(OpenMode.CREATE));
 
     // TODO: we could index in radians instead ... saves all the conversions in getBoundingBoxFilter
 
@@ -246,7 +245,6 @@ public class DistanceFacetsExample imple
   }
 
   /** Runs the search and drill-down examples and prints the results. */
-  @SuppressWarnings("unchecked")
   public static void main(String[] args) throws Exception {
     DistanceFacetsExample example = new DistanceFacetsExample();
     example.index();
@@ -255,7 +253,6 @@ public class DistanceFacetsExample imple
     System.out.println("-----------------------");
     System.out.println(example.search());
 
-    System.out.println("\n");
     System.out.println("Distance facet drill-down example (field/< 2 km):");
     System.out.println("---------------------------------------------");
     TopDocs hits = example.drillDown(example.TWO_KM);

Modified: lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/ExpressionAggregationFacetsExample.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/ExpressionAggregationFacetsExample.java?rev=1628413&r1=1628412&r2=1628413&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/ExpressionAggregationFacetsExample.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/ExpressionAggregationFacetsExample.java
Tue Sep 30 12:11:13 2014
@@ -23,6 +23,7 @@ import org.apache.lucene.facet.taxonomy.
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.search.SortField;
@@ -59,7 +60,7 @@ public class ExpressionAggregationFacets
   /** Build the example index. */
   private void index() throws IOException {
     IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(
-        new WhitespaceAnalyzer()));
+        new WhitespaceAnalyzer()).setOpenMode(OpenMode.CREATE));
 
     // Writes facet ords to a separate directory from the main index
     DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir);

Modified: lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/MultiCategoryListsFacetsExample.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/MultiCategoryListsFacetsExample.java?rev=1628413&r1=1628412&r2=1628413&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/MultiCategoryListsFacetsExample.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/MultiCategoryListsFacetsExample.java
Tue Sep 30 12:11:13 2014
@@ -35,6 +35,7 @@ import org.apache.lucene.facet.taxonomy.
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.store.Directory;
@@ -47,7 +48,7 @@ public class MultiCategoryListsFacetsExa
   private final Directory taxoDir = new RAMDirectory();
   private final FacetsConfig config = new FacetsConfig();
 
-  /** Creates a new instance and populates the catetory list params mapping. */
+  /** Creates a new instance and populates the category list params mapping. */
   public MultiCategoryListsFacetsExample() {
     config.setIndexFieldName("Author", "author");
     config.setIndexFieldName("Publish Date", "pubdate");
@@ -57,7 +58,7 @@ public class MultiCategoryListsFacetsExa
   /** Build the example index. */
   private void index() throws IOException {
     IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(
-        new WhitespaceAnalyzer()));
+        new WhitespaceAnalyzer()).setOpenMode(OpenMode.CREATE));
 
     // Writes facet ords to a separate directory from the main index
     DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir);

Modified: lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/RangeFacetsExample.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/RangeFacetsExample.java?rev=1628413&r1=1628412&r2=1628413&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/RangeFacetsExample.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/RangeFacetsExample.java
Tue Sep 30 12:11:13 2014
@@ -35,6 +35,7 @@ import org.apache.lucene.facet.range.Lon
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.search.NumericRangeQuery;
@@ -42,8 +43,6 @@ import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.RAMDirectory;
 
-
-
 /** Shows simple usage of dynamic range faceting. */
 public class RangeFacetsExample implements Closeable {
 
@@ -61,7 +60,7 @@ public class RangeFacetsExample implemen
   /** Build the example index. */
   public void index() throws IOException {
     IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(
-        new WhitespaceAnalyzer()));
+        new WhitespaceAnalyzer()).setOpenMode(OpenMode.CREATE));
 
     // Add documents with a fake timestamp, 1000 sec before
     // "now", 2000 sec before "now", ...:
@@ -121,7 +120,6 @@ public class RangeFacetsExample implemen
   }
 
   /** Runs the search and drill-down examples and prints the results. */
-  @SuppressWarnings("unchecked")
   public static void main(String[] args) throws Exception {
     RangeFacetsExample example = new RangeFacetsExample();
     example.index();

Modified: lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleFacetsExample.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleFacetsExample.java?rev=1628413&r1=1628412&r2=1628413&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleFacetsExample.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleFacetsExample.java
Tue Sep 30 12:11:13 2014
@@ -38,6 +38,7 @@ import org.apache.lucene.facet.taxonomy.
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.store.Directory;
@@ -58,7 +59,7 @@ public class SimpleFacetsExample {
   /** Build the example index. */
   private void index() throws IOException {
     IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(
-        new WhitespaceAnalyzer()));
+        new WhitespaceAnalyzer()).setOpenMode(OpenMode.CREATE));
 
     // Writes facet ords to a separate directory from the main index
     DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir);
@@ -235,17 +236,14 @@ public class SimpleFacetsExample {
     
     System.out.println("Facet counting example (combined facets and search):");
     System.out.println("-----------------------");
-    example = new SimpleFacetsExample();
     List<FacetResult> results = example.runSearch();
     System.out.println("Author: " + results.get(0));
     System.out.println("Publish Date: " + results.get(1));
     
-    example = new SimpleFacetsExample();
     System.out.println("Facet drill-down example (Publish Date/2010):");
     System.out.println("---------------------------------------------");
     System.out.println("Author: " + example.runDrillDown());
 
-    example = new SimpleFacetsExample();
     System.out.println("Facet drill-sideways example (Publish Date/2010):");
     System.out.println("---------------------------------------------");
     for(FacetResult result : example.runDrillSideways()) {

Modified: lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleSortedSetFacetsExample.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleSortedSetFacetsExample.java?rev=1628413&r1=1628412&r2=1628413&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleSortedSetFacetsExample.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleSortedSetFacetsExample.java
Tue Sep 30 12:11:13 2014
@@ -35,6 +35,7 @@ import org.apache.lucene.facet.sortedset
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.store.Directory;
@@ -56,7 +57,7 @@ public class SimpleSortedSetFacetsExampl
   /** Build the example index. */
   private void index() throws IOException {
     IndexWriter indexWriter = new IndexWriter(indexDir, new IndexWriterConfig(
-        new WhitespaceAnalyzer()));
+        new WhitespaceAnalyzer()).setOpenMode(OpenMode.CREATE));
     Document doc = new Document();
     doc.add(new SortedSetDocValuesFacetField("Author", "Bob"));
     doc.add(new SortedSetDocValuesFacetField("Publish Year", "2010"));



Mime
View raw message