Apache Lucene open-source search software
LUCENE-3549: port to trunk
Shai Erera145d7503a3a4
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.javaindex 21e8475001a..a17454eeff1 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@@ -14,7 +14,6 @@ import org.apache.lucene.index.IndexWriterConfig.OpenMode;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 fieldsdiff --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.javaindex 117fa1386a7..644ce356c5b 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@@ -11,7 +11,6 @@ import org.apache.lucene.index.IndexWriterConfig;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 itDocument doc = new Document();diff --git a/modules/facet/src/java/org/apache/lucene/DocumentBuilder.java b/modules/facet/src/java/org/apache/lucene/DocumentBuilder.javaindex 26cee4b2f2e..e69de29bb2d 100644--- a/modules/facet/src/java/org/apache/lucene/DocumentBuilder.java+++ b/modules/facet/src/java/org/apache/lucene/DocumentBuilder.java@@ -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;--}diff --git a/modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java b/modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.javaindex fb5c1831f43..e6622ac23e6 100644--- a/modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java+++ b/modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java@@ -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.TaxonomyWriter;** @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 implements DocumentBuilder {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);diff --git a/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java b/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.javaindex d57853988cf..1c18056db30 100644--- a/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java+++ b/modules/facet/src/test/org/apache/lucene/facet/FacetTestBase.java@@ -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 extends LuceneTestCase {* <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 documentsint numDocsToIndex = numDocsToIndex();for (int doc=0; doc<numDocsToIndex; doc++) {diff --git a/modules/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java b/modules/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.javaindex 20ebcdd8e49..bfdffe49dea 100644--- a/modules/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java+++ b/modules/facet/src/test/org/apache/lucene/facet/search/BaseTestTopK.java@@ -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 extends FacetTestBase {@Overrideprotected void populateIndex(RandomIndexWriter iw, TaxonomyWriter taxo,- FacetIndexingParams iParams) throws IOException,- DocumentBuilderException, CorruptIndexException {+ FacetIndexingParams iParams) throws IOException, CorruptIndexException {currDoc = -1;super.populateIndex(iw, taxo, iParams);}