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 2011/11/02 08:07:08 UTC

svn commit: r1196474 - in /lucene/dev/trunk/modules/facet/src: examples/org/apache/lucene/facet/example/multiCL/ examples/org/apache/lucene/facet/example/simple/ java/org/apache/lucene/ java/org/apache/lucene/facet/index/ test/org/apache/lucene/facet/ ...

Author: shaie
Date: Wed Nov  2 07:07:07 2011
New Revision: 1196474

URL: http://svn.apache.org/viewvc?rev=1196474&view=rev
Log:
LUCENE-3549: port to trunk

Modified:
    lucene/dev/trunk/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLIndexer.java
    lucene/dev/trunk/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleIndexer.java
    lucene/dev/trunk/modules/facet/src/java/org/apache/lucene/DocumentBuilder.java
    lucene/dev/trunk/modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java
    lucene/dev/trunk/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java
    lucene/dev/trunk/modules/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java

Modified: lucene/dev/trunk/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLIndexer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLIndexer.java?rev=1196474&r1=1196473&r2=1196474&view=diff
==============================================================================
--- lucene/dev/trunk/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLIndexer.java (original)
+++ lucene/dev/trunk/modules/facet/src/examples/org/apache/lucene/facet/example/multiCL/MultiCLIndexer.java Wed Nov  2 07:07:07 2011
@@ -14,7 +14,6 @@ import org.apache.lucene.index.IndexWrit
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.RAMDirectory;
 
-import org.apache.lucene.DocumentBuilder;
 import org.apache.lucene.facet.example.ExampleUtils;
 import org.apache.lucene.facet.example.simple.SimpleUtils;
 import org.apache.lucene.facet.index.CategoryDocumentBuilder;
@@ -167,7 +166,7 @@ public class MultiCLIndexer {
       // we do not alter indexing parameters!
       // a category document builder will add the categories to a document
       // once build() is called
-      DocumentBuilder categoryDocBuilder = new CategoryDocumentBuilder(
+      CategoryDocumentBuilder categoryDocBuilder = new CategoryDocumentBuilder(
           taxo, iParams).setCategoryPaths(facetList);
 
       // create a plain Lucene document and add some regular Lucene fields

Modified: lucene/dev/trunk/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleIndexer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleIndexer.java?rev=1196474&r1=1196473&r2=1196474&view=diff
==============================================================================
--- lucene/dev/trunk/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleIndexer.java (original)
+++ lucene/dev/trunk/modules/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleIndexer.java Wed Nov  2 07:07:07 2011
@@ -11,7 +11,6 @@ import org.apache.lucene.index.IndexWrit
 import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.store.Directory;
 
-import org.apache.lucene.DocumentBuilder;
 import org.apache.lucene.facet.example.ExampleUtils;
 import org.apache.lucene.facet.index.CategoryDocumentBuilder;
 import org.apache.lucene.facet.taxonomy.CategoryPath;
@@ -66,7 +65,7 @@ public class SimpleIndexer {
 
       // we do not alter indexing parameters!  
       // a category document builder will add the categories to a document once build() is called
-      DocumentBuilder categoryDocBuilder = new CategoryDocumentBuilder(taxo).setCategoryPaths(facetList);
+      CategoryDocumentBuilder categoryDocBuilder = new CategoryDocumentBuilder(taxo).setCategoryPaths(facetList);
 
       // create a plain Lucene document and add some regular Lucene fields to it 
       Document doc = new Document();

Modified: lucene/dev/trunk/modules/facet/src/java/org/apache/lucene/DocumentBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/facet/src/java/org/apache/lucene/DocumentBuilder.java?rev=1196474&r1=1196473&r2=1196474&view=diff
==============================================================================
--- lucene/dev/trunk/modules/facet/src/java/org/apache/lucene/DocumentBuilder.java (original)
+++ lucene/dev/trunk/modules/facet/src/java/org/apache/lucene/DocumentBuilder.java Wed Nov  2 07:07:07 2011
@@ -1,77 +0,0 @@
-package org.apache.lucene;
-
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-
-/**
- * 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.
- */
-
-/**
- * An interface which standardizes the process of building an indexable
- * {@link Document}.
- * <p>
- * The idea is that implementations implement {@link #build(Document doc)},
- * which adds to the given Document whatever {@link Field}s it wants to add. A
- * DocumentBuilder is also allowed to inspect or change existing Fields in the
- * Document, if it wishes to.
- * <p>
- * Implementations should normally have a constructor with parameters which
- * determine what {@link #build(Document)} will add to doc.<br>
- * To allow reuse of the DocumentBuilder object, implementations are also
- * encouraged to have a setter method, which remembers its parameters just like
- * the constructor. This setter method cannot be described in this interface,
- * because it will take different parameters in each implementation.
- * <p>
- * The interface defines a builder pattern, which allows applications to invoke
- * several document builders in the following way:
- * 
- * <pre>
- * builder1.build(builder2.build(builder3.build(new Document())));
- * </pre>
- * 
- * @lucene.experimental
- */
-public interface DocumentBuilder {
- 
-  /** An exception thrown from {@link DocumentBuilder}'s build(). */
-  public static class DocumentBuilderException extends Exception {
-
-    public DocumentBuilderException() {
-      super();
-    }
-
-    public DocumentBuilderException(String message) {
-      super(message);
-    }
-
-    public DocumentBuilderException(String message, Throwable cause) {
-      super(message, cause);
-    }
-
-    public DocumentBuilderException(Throwable cause) {
-      super(cause);
-    }
-
-  }
-
-  /**
-   * Adds to the given document whatever {@link Field}s the implementation needs
-   * to add. Return the docunment instance to allow for chaining calls.
-   */
-  public Document build(Document doc) throws DocumentBuilderException;
-  
-}

Modified: lucene/dev/trunk/modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java?rev=1196474&r1=1196473&r2=1196474&view=diff
==============================================================================
--- lucene/dev/trunk/modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java (original)
+++ lucene/dev/trunk/modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java Wed Nov  2 07:07:07 2011
@@ -13,7 +13,6 @@ import org.apache.lucene.document.Field;
 import org.apache.lucene.document.FieldType;
 import org.apache.lucene.document.TextField;
 
-import org.apache.lucene.DocumentBuilder;
 import org.apache.lucene.facet.index.attributes.CategoryAttribute;
 import org.apache.lucene.facet.index.attributes.CategoryAttributesIterable;
 import org.apache.lucene.facet.index.categorypolicy.OrdinalPolicy;
@@ -64,7 +63,7 @@ import org.apache.lucene.facet.taxonomy.
  * 
  * @lucene.experimental
  */
-public class CategoryDocumentBuilder implements DocumentBuilder {
+public class CategoryDocumentBuilder {
 
   /**
    * A {@link TaxonomyWriter} for adding categories and retrieving their
@@ -288,9 +287,7 @@ public class CategoryDocumentBuilder imp
     return new CategoryTokenizer(categoryStream, indexingParams);
   }
 
-  /**
-   * Adds the fields created in one of the "set" methods to the document
-   */
+  /** Adds the fields created in one of the "set" methods to the document */
   public Document build(Document doc) {
     for (Field f : fieldList) {
       doc.add(f);

Modified: lucene/dev/trunk/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java?rev=1196474&r1=1196473&r2=1196474&view=diff
==============================================================================
--- lucene/dev/trunk/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java (original)
+++ lucene/dev/trunk/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java Wed Nov  2 07:07:07 2011
@@ -9,7 +9,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.lucene.DocumentBuilder.DocumentBuilderException;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.analysis.MockTokenizer;
@@ -191,7 +190,7 @@ public abstract class FacetTestBase exte
    * <p>Subclasses can override this to test different scenarios
    */
   protected void populateIndex(RandomIndexWriter iw, TaxonomyWriter taxo, FacetIndexingParams iParams)
-      throws IOException, DocumentBuilderException, CorruptIndexException {
+      throws IOException, CorruptIndexException {
     // add test documents 
     int numDocsToIndex = numDocsToIndex();
     for (int doc=0; doc<numDocsToIndex; doc++) {

Modified: lucene/dev/trunk/modules/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java?rev=1196474&r1=1196473&r2=1196474&view=diff
==============================================================================
--- lucene/dev/trunk/modules/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java (original)
+++ lucene/dev/trunk/modules/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java Wed Nov  2 07:07:07 2011
@@ -4,7 +4,6 @@ import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.lucene.DocumentBuilder.DocumentBuilderException;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.RandomIndexWriter;
@@ -52,8 +51,7 @@ public abstract class BaseTestTopK exten
 
   @Override
   protected void populateIndex(RandomIndexWriter iw, TaxonomyWriter taxo,
-      FacetIndexingParams iParams) throws IOException,
-      DocumentBuilderException, CorruptIndexException {
+      FacetIndexingParams iParams) throws IOException, CorruptIndexException {
     currDoc = -1;
     super.populateIndex(iw, taxo, iParams);
   }