mirror of https://github.com/apache/lucene.git
add missing javadocs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1440829 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c1024f192e
commit
f21ce95241
|
@ -30,17 +30,20 @@ import org.apache.lucene.facet.search.results.FacetResult;
|
||||||
*/
|
*/
|
||||||
public class ExampleResult {
|
public class ExampleResult {
|
||||||
|
|
||||||
|
/** Sole constructor. */
|
||||||
|
public ExampleResult() {}
|
||||||
|
|
||||||
private List<FacetResult> facetResults;
|
private List<FacetResult> facetResults;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the facet results
|
* Returns the facet results
|
||||||
*/
|
*/
|
||||||
public List<FacetResult> getFacetResults() {
|
public List<FacetResult> getFacetResults() {
|
||||||
return facetResults;
|
return facetResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param facetResults the facet results to set
|
* Sets the facet results
|
||||||
*/
|
*/
|
||||||
public void setFacetResults(List<FacetResult> facetResults) {
|
public void setFacetResults(List<FacetResult> facetResults) {
|
||||||
this.facetResults = facetResults;
|
this.facetResults = facetResults;
|
||||||
|
|
|
@ -20,15 +20,28 @@ import org.apache.lucene.util.Version;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Simple utility functions for the faceting examples
|
||||||
* @lucene.experimental
|
* @lucene.experimental
|
||||||
*/
|
*/
|
||||||
public class ExampleUtils {
|
public class ExampleUtils {
|
||||||
|
|
||||||
|
/** No instance */
|
||||||
|
private ExampleUtils() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if the system property <code>tests.verbose</code> has been set.
|
||||||
|
* If true, it causes {@link #log(Object)} to print messages to the console.
|
||||||
|
*/
|
||||||
public static final boolean VERBOSE = Boolean.getBoolean("tests.verbose");
|
public static final boolean VERBOSE = Boolean.getBoolean("tests.verbose");
|
||||||
|
|
||||||
/** The Lucene {@link Version} used by the example code. */
|
/** The Lucene {@link Version} used by the example code. */
|
||||||
public static final Version EXAMPLE_VER = Version.LUCENE_40;
|
public static final Version EXAMPLE_VER = Version.LUCENE_40;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs the String representation of <code>msg</code> to the console,
|
||||||
|
* if {@link #VERBOSE} is true. Otherwise, does nothing.
|
||||||
|
* @see #VERBOSE
|
||||||
|
*/
|
||||||
public static void log(Object msg) {
|
public static void log(Object msg) {
|
||||||
if (VERBOSE) {
|
if (VERBOSE) {
|
||||||
System.out.println(msg.toString());
|
System.out.println(msg.toString());
|
||||||
|
|
|
@ -37,6 +37,9 @@ import org.apache.lucene.facet.search.results.FacetResult;
|
||||||
*/
|
*/
|
||||||
public class AdaptiveMain {
|
public class AdaptiveMain {
|
||||||
|
|
||||||
|
/** Sole constructor */
|
||||||
|
public AdaptiveMain() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Driver for the adaptive sample.
|
* Driver for the adaptive sample.
|
||||||
* @throws Exception on error (no detailed exception handling here for sample simplicity
|
* @throws Exception on error (no detailed exception handling here for sample simplicity
|
||||||
|
@ -46,6 +49,7 @@ public class AdaptiveMain {
|
||||||
ExampleUtils.log("DONE");
|
ExampleUtils.log("DONE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Runs the adaptive sample and returns the facet results */
|
||||||
public ExampleResult runSample() throws Exception {
|
public ExampleResult runSample() throws Exception {
|
||||||
|
|
||||||
// create Directories for the search index and for the taxonomy index
|
// create Directories for the search index and for the taxonomy index
|
||||||
|
|
|
@ -46,6 +46,9 @@ import org.apache.lucene.store.Directory;
|
||||||
*/
|
*/
|
||||||
public class AdaptiveSearcher {
|
public class AdaptiveSearcher {
|
||||||
|
|
||||||
|
/** No instance */
|
||||||
|
private AdaptiveSearcher() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search with facets through the {@link AdaptiveFacetsAccumulator}
|
* Search with facets through the {@link AdaptiveFacetsAccumulator}
|
||||||
* @param indexDir Directory of the search index.
|
* @param indexDir Directory of the search index.
|
||||||
|
|
|
@ -41,6 +41,9 @@ import org.apache.lucene.store.Directory;
|
||||||
*/
|
*/
|
||||||
public class CategoryAssociationsIndexer {
|
public class CategoryAssociationsIndexer {
|
||||||
|
|
||||||
|
/** No instance. */
|
||||||
|
private CategoryAssociationsIndexer() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an index, and adds to it sample documents and categories.
|
* Create an index, and adds to it sample documents and categories.
|
||||||
*
|
*
|
||||||
|
|
|
@ -33,6 +33,9 @@ import org.apache.lucene.facet.search.results.FacetResult;
|
||||||
*/
|
*/
|
||||||
public class CategoryAssociationsMain {
|
public class CategoryAssociationsMain {
|
||||||
|
|
||||||
|
/** Sole constructor. */
|
||||||
|
public CategoryAssociationsMain() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Driver for the simple sample.
|
* Driver for the simple sample.
|
||||||
* @throws Exception on error (no detailed exception handling here for sample simplicity
|
* @throws Exception on error (no detailed exception handling here for sample simplicity
|
||||||
|
@ -43,6 +46,9 @@ public class CategoryAssociationsMain {
|
||||||
ExampleUtils.log("DONE");
|
ExampleUtils.log("DONE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the example demonstrating sum of int-association.
|
||||||
|
*/
|
||||||
public ExampleResult runSumIntAssociationSample() throws Exception {
|
public ExampleResult runSumIntAssociationSample() throws Exception {
|
||||||
|
|
||||||
// create Directories for the search index and for the taxonomy index
|
// create Directories for the search index and for the taxonomy index
|
||||||
|
@ -61,6 +67,9 @@ public class CategoryAssociationsMain {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the example demonstrating sum of float-association.
|
||||||
|
*/
|
||||||
public ExampleResult runSumFloatAssociationSample() throws Exception {
|
public ExampleResult runSumFloatAssociationSample() throws Exception {
|
||||||
|
|
||||||
// create Directories for the search index and for the taxonomy index
|
// create Directories for the search index and for the taxonomy index
|
||||||
|
|
|
@ -39,6 +39,9 @@ import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
|
||||||
*/
|
*/
|
||||||
public class CategoryAssociationsSearcher {
|
public class CategoryAssociationsSearcher {
|
||||||
|
|
||||||
|
/** No instantiation */
|
||||||
|
private CategoryAssociationsSearcher() {}
|
||||||
|
|
||||||
/** Search an index with a sum of int-association. */
|
/** Search an index with a sum of int-association. */
|
||||||
public static List<FacetResult> searchSumIntAssociation(Directory indexDir, Directory taxoDir) throws Exception {
|
public static List<FacetResult> searchSumIntAssociation(Directory indexDir, Directory taxoDir) throws Exception {
|
||||||
// prepare index reader
|
// prepare index reader
|
||||||
|
|
|
@ -23,10 +23,14 @@ import org.apache.lucene.facet.taxonomy.CategoryPath;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Categories for the facet examples
|
||||||
* @lucene.experimental
|
* @lucene.experimental
|
||||||
*/
|
*/
|
||||||
public class CategoryAssociationsUtils {
|
public class CategoryAssociationsUtils {
|
||||||
|
|
||||||
|
/** No instance */
|
||||||
|
private CategoryAssociationsUtils() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Categories: categories[D][N] == category-path with association no. N for
|
* Categories: categories[D][N] == category-path with association no. N for
|
||||||
* document no. D.
|
* document no. D.
|
||||||
|
@ -45,6 +49,9 @@ public class CategoryAssociationsUtils {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associations (occurrences/confidence levels) for {@link #categories}
|
||||||
|
*/
|
||||||
public static CategoryAssociation[][] associations = {
|
public static CategoryAssociation[][] associations = {
|
||||||
// Doc #1 associations
|
// Doc #1 associations
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,13 +49,16 @@ import org.apache.lucene.store.RAMDirectory;
|
||||||
*/
|
*/
|
||||||
public class MultiCLIndexer {
|
public class MultiCLIndexer {
|
||||||
|
|
||||||
// Number of documents to index
|
/** No instance */
|
||||||
|
private MultiCLIndexer() {}
|
||||||
|
|
||||||
|
/** Number of documents to index */
|
||||||
public static int NUM_DOCS = 100;
|
public static int NUM_DOCS = 100;
|
||||||
// Number of facets to add per document
|
/** Number of facets to add per document */
|
||||||
public static int NUM_FACETS_PER_DOC = 10;
|
public static int NUM_FACETS_PER_DOC = 10;
|
||||||
// Number of tokens in title
|
/** Number of tokens in title */
|
||||||
public static int TITLE_LENGTH = 5;
|
public static int TITLE_LENGTH = 5;
|
||||||
// Number of tokens in text
|
/** Number of tokens in text */
|
||||||
public static int TEXT_LENGTH = 100;
|
public static int TEXT_LENGTH = 100;
|
||||||
|
|
||||||
// Lorum ipsum to use as content - this will be tokenized and used for document
|
// Lorum ipsum to use as content - this will be tokenized and used for document
|
||||||
|
@ -73,7 +76,7 @@ public class MultiCLIndexer {
|
||||||
+ "nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure"
|
+ "nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure"
|
||||||
+ "reprehenderit qui in ea voluptate velit esse quam nihil molestiae "
|
+ "reprehenderit qui in ea voluptate velit esse quam nihil molestiae "
|
||||||
+ "consequatur vel illum qui dolorem eum fugiat quo voluptas nulla pariatur";
|
+ "consequatur vel illum qui dolorem eum fugiat quo voluptas nulla pariatur";
|
||||||
// PerDimensionIndexingParams for multiple category lists
|
/** PerDimensionIndexingParams for multiple category lists */
|
||||||
public static final PerDimensionIndexingParams MULTI_IPARAMS;
|
public static final PerDimensionIndexingParams MULTI_IPARAMS;
|
||||||
|
|
||||||
// Initialize PerDimensionIndexingParams
|
// Initialize PerDimensionIndexingParams
|
||||||
|
@ -199,6 +202,7 @@ public class MultiCLIndexer {
|
||||||
+ nFacetsAdded + " facets.");
|
+ nFacetsAdded + " facets.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Driver for the example */
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
index(new RAMDirectory(), new RAMDirectory());
|
index(new RAMDirectory(), new RAMDirectory());
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,17 @@ import org.apache.lucene.facet.search.results.FacetResult;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Driver for the multi sample.
|
||||||
|
*
|
||||||
* @lucene.experimental
|
* @lucene.experimental
|
||||||
*/
|
*/
|
||||||
public class MultiCLMain {
|
public class MultiCLMain {
|
||||||
|
|
||||||
|
/** Sole constructor. */
|
||||||
|
public MultiCLMain() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Driver for the multi sample.
|
* Executes the multi sample.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* on error (no detailed exception handling here for sample
|
* on error (no detailed exception handling here for sample
|
||||||
|
@ -43,6 +48,7 @@ public class MultiCLMain {
|
||||||
ExampleUtils.log("DONE");
|
ExampleUtils.log("DONE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Runs the multi sample and returns the facet results */
|
||||||
public ExampleResult runSample() throws Exception {
|
public ExampleResult runSample() throws Exception {
|
||||||
|
|
||||||
// create Directories for the search index and for the taxonomy index
|
// create Directories for the search index and for the taxonomy index
|
||||||
|
|
|
@ -50,6 +50,9 @@ import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
|
||||||
*/
|
*/
|
||||||
public class MultiCLSearcher {
|
public class MultiCLSearcher {
|
||||||
|
|
||||||
|
/** No instance */
|
||||||
|
private MultiCLSearcher() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search an index with facets.
|
* Search an index with facets.
|
||||||
*
|
*
|
||||||
|
@ -78,6 +81,18 @@ public class MultiCLSearcher {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search an index with facets.
|
||||||
|
*
|
||||||
|
* @param indexReader
|
||||||
|
* Reader over the search index.
|
||||||
|
* @param taxo
|
||||||
|
* taxonomy reader.
|
||||||
|
* @throws Exception
|
||||||
|
* on error (no detailed exception handling here for sample
|
||||||
|
* simplicity
|
||||||
|
* @return facet results
|
||||||
|
*/
|
||||||
public static List<FacetResult> searchWithFacets(IndexReader indexReader,
|
public static List<FacetResult> searchWithFacets(IndexReader indexReader,
|
||||||
TaxonomyReader taxo, FacetIndexingParams iParams) throws Exception {
|
TaxonomyReader taxo, FacetIndexingParams iParams) throws Exception {
|
||||||
// prepare searcher to search against
|
// prepare searcher to search against
|
||||||
|
|
|
@ -40,6 +40,9 @@ import org.apache.lucene.store.Directory;
|
||||||
*/
|
*/
|
||||||
public class SimpleIndexer {
|
public class SimpleIndexer {
|
||||||
|
|
||||||
|
/** No instance */
|
||||||
|
private SimpleIndexer() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an index, and adds to it sample documents and facets.
|
* Create an index, and adds to it sample documents and facets.
|
||||||
* @param indexDir Directory in which the index should be created.
|
* @param indexDir Directory in which the index should be created.
|
||||||
|
|
|
@ -37,6 +37,9 @@ import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
|
||||||
*/
|
*/
|
||||||
public class SimpleMain {
|
public class SimpleMain {
|
||||||
|
|
||||||
|
/** Sole constructor */
|
||||||
|
public SimpleMain() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Driver for the simple sample.
|
* Driver for the simple sample.
|
||||||
* @throws Exception on error (no detailed exception handling here for sample simplicity
|
* @throws Exception on error (no detailed exception handling here for sample simplicity
|
||||||
|
@ -47,6 +50,7 @@ public class SimpleMain {
|
||||||
ExampleUtils.log("DONE");
|
ExampleUtils.log("DONE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Runs the simple sample and returns the facet results */
|
||||||
public ExampleResult runSimple() throws Exception {
|
public ExampleResult runSimple() throws Exception {
|
||||||
// create Directories for the search index and for the taxonomy index
|
// create Directories for the search index and for the taxonomy index
|
||||||
Directory indexDir = new RAMDirectory();
|
Directory indexDir = new RAMDirectory();
|
||||||
|
@ -72,6 +76,7 @@ public class SimpleMain {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Runs the simple sample and returns drilldown results */
|
||||||
public ExampleResult runDrillDown() throws Exception {
|
public ExampleResult runDrillDown() throws Exception {
|
||||||
// create Directories for the search index and for the taxonomy index
|
// create Directories for the search index and for the taxonomy index
|
||||||
Directory indexDir = new RAMDirectory();
|
Directory indexDir = new RAMDirectory();
|
||||||
|
|
|
@ -47,6 +47,9 @@ import org.apache.lucene.search.TopScoreDocCollector;
|
||||||
*/
|
*/
|
||||||
public class SimpleSearcher {
|
public class SimpleSearcher {
|
||||||
|
|
||||||
|
/** No instance */
|
||||||
|
private SimpleSearcher() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search an index with facets.
|
* Search an index with facets.
|
||||||
* @param indexReader index reader.
|
* @param indexReader index reader.
|
||||||
|
|
|
@ -29,6 +29,9 @@ import org.apache.lucene.facet.taxonomy.CategoryPath;
|
||||||
*/
|
*/
|
||||||
public class SimpleUtils {
|
public class SimpleUtils {
|
||||||
|
|
||||||
|
/** No instance */
|
||||||
|
private SimpleUtils() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Documents text field.
|
* Documents text field.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.lucene.util.Version;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Utility methods for merging index and taxonomy directories.
|
||||||
* @lucene.experimental
|
* @lucene.experimental
|
||||||
*/
|
*/
|
||||||
public class TaxonomyMergeUtils {
|
public class TaxonomyMergeUtils {
|
||||||
|
|
Loading…
Reference in New Issue