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
|
@ -29,18 +29,21 @@ import org.apache.lucene.facet.search.results.FacetResult;
|
|||
* @lucene.experimental
|
||||
*/
|
||||
public class ExampleResult {
|
||||
|
||||
/** Sole constructor. */
|
||||
public ExampleResult() {}
|
||||
|
||||
private List<FacetResult> facetResults;
|
||||
|
||||
/**
|
||||
* @return the facet results
|
||||
* Returns the facet results
|
||||
*/
|
||||
public List<FacetResult> getFacetResults() {
|
||||
return facetResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param facetResults the facet results to set
|
||||
* Sets the facet results
|
||||
*/
|
||||
public void setFacetResults(List<FacetResult> facetResults) {
|
||||
this.facetResults = facetResults;
|
||||
|
|
|
@ -20,15 +20,28 @@ import org.apache.lucene.util.Version;
|
|||
*/
|
||||
|
||||
/**
|
||||
* Simple utility functions for the faceting examples
|
||||
* @lucene.experimental
|
||||
*/
|
||||
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");
|
||||
|
||||
/** The Lucene {@link Version} used by the example code. */
|
||||
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) {
|
||||
if (VERBOSE) {
|
||||
System.out.println(msg.toString());
|
||||
|
|
|
@ -36,6 +36,9 @@ import org.apache.lucene.facet.search.results.FacetResult;
|
|||
* @lucene.experimental
|
||||
*/
|
||||
public class AdaptiveMain {
|
||||
|
||||
/** Sole constructor */
|
||||
public AdaptiveMain() {}
|
||||
|
||||
/**
|
||||
* Driver for the adaptive sample.
|
||||
|
@ -46,6 +49,7 @@ public class AdaptiveMain {
|
|||
ExampleUtils.log("DONE");
|
||||
}
|
||||
|
||||
/** Runs the adaptive sample and returns the facet results */
|
||||
public ExampleResult runSample() throws Exception {
|
||||
|
||||
// create Directories for the search index and for the taxonomy index
|
||||
|
|
|
@ -46,6 +46,9 @@ import org.apache.lucene.store.Directory;
|
|||
*/
|
||||
public class AdaptiveSearcher {
|
||||
|
||||
/** No instance */
|
||||
private AdaptiveSearcher() {}
|
||||
|
||||
/**
|
||||
* Search with facets through the {@link AdaptiveFacetsAccumulator}
|
||||
* @param indexDir Directory of the search index.
|
||||
|
|
|
@ -40,6 +40,9 @@ import org.apache.lucene.store.Directory;
|
|||
* @lucene.experimental
|
||||
*/
|
||||
public class CategoryAssociationsIndexer {
|
||||
|
||||
/** No instance. */
|
||||
private CategoryAssociationsIndexer() {}
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
/** Sole constructor. */
|
||||
public CategoryAssociationsMain() {}
|
||||
|
||||
/**
|
||||
* Driver for the simple sample.
|
||||
* @throws Exception on error (no detailed exception handling here for sample simplicity
|
||||
|
@ -43,6 +46,9 @@ public class CategoryAssociationsMain {
|
|||
ExampleUtils.log("DONE");
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the example demonstrating sum of int-association.
|
||||
*/
|
||||
public ExampleResult runSumIntAssociationSample() throws Exception {
|
||||
|
||||
// create Directories for the search index and for the taxonomy index
|
||||
|
@ -61,6 +67,9 @@ public class CategoryAssociationsMain {
|
|||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the example demonstrating sum of float-association.
|
||||
*/
|
||||
public ExampleResult runSumFloatAssociationSample() throws Exception {
|
||||
|
||||
// create Directories for the search index and for the taxonomy index
|
||||
|
|
|
@ -38,6 +38,9 @@ import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
|
|||
* @lucene.experimental
|
||||
*/
|
||||
public class CategoryAssociationsSearcher {
|
||||
|
||||
/** No instantiation */
|
||||
private CategoryAssociationsSearcher() {}
|
||||
|
||||
/** Search an index with a sum of int-association. */
|
||||
public static List<FacetResult> searchSumIntAssociation(Directory indexDir, Directory taxoDir) throws Exception {
|
||||
|
|
|
@ -23,9 +23,13 @@ import org.apache.lucene.facet.taxonomy.CategoryPath;
|
|||
*/
|
||||
|
||||
/**
|
||||
* Categories for the facet examples
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class CategoryAssociationsUtils {
|
||||
|
||||
/** No instance */
|
||||
private CategoryAssociationsUtils() {}
|
||||
|
||||
/**
|
||||
* Categories: categories[D][N] == category-path with association no. N for
|
||||
|
@ -45,6 +49,9 @@ public class CategoryAssociationsUtils {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Associations (occurrences/confidence levels) for {@link #categories}
|
||||
*/
|
||||
public static CategoryAssociation[][] associations = {
|
||||
// Doc #1 associations
|
||||
{
|
||||
|
|
|
@ -48,14 +48,17 @@ import org.apache.lucene.store.RAMDirectory;
|
|||
* @lucene.experimental
|
||||
*/
|
||||
public class MultiCLIndexer {
|
||||
|
||||
/** No instance */
|
||||
private MultiCLIndexer() {}
|
||||
|
||||
// Number of documents to index
|
||||
/** Number of documents to index */
|
||||
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;
|
||||
// Number of tokens in title
|
||||
/** Number of tokens in title */
|
||||
public static int TITLE_LENGTH = 5;
|
||||
// Number of tokens in text
|
||||
/** Number of tokens in text */
|
||||
public static int TEXT_LENGTH = 100;
|
||||
|
||||
// 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"
|
||||
+ "reprehenderit qui in ea voluptate velit esse quam nihil molestiae "
|
||||
+ "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;
|
||||
|
||||
// Initialize PerDimensionIndexingParams
|
||||
|
@ -199,6 +202,7 @@ public class MultiCLIndexer {
|
|||
+ nFacetsAdded + " facets.");
|
||||
}
|
||||
|
||||
/** Driver for the example */
|
||||
public static void main(String[] args) throws Exception {
|
||||
index(new RAMDirectory(), new RAMDirectory());
|
||||
}
|
||||
|
|
|
@ -27,12 +27,17 @@ import org.apache.lucene.facet.search.results.FacetResult;
|
|||
*/
|
||||
|
||||
/**
|
||||
* Driver for the multi sample.
|
||||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class MultiCLMain {
|
||||
|
||||
/** Sole constructor. */
|
||||
public MultiCLMain() {}
|
||||
|
||||
/**
|
||||
* Driver for the multi sample.
|
||||
* Executes the multi sample.
|
||||
*
|
||||
* @throws Exception
|
||||
* on error (no detailed exception handling here for sample
|
||||
|
@ -43,6 +48,7 @@ public class MultiCLMain {
|
|||
ExampleUtils.log("DONE");
|
||||
}
|
||||
|
||||
/** Runs the multi sample and returns the facet results */
|
||||
public ExampleResult runSample() throws Exception {
|
||||
|
||||
// create Directories for the search index and for the taxonomy index
|
||||
|
|
|
@ -49,6 +49,9 @@ import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
|
|||
* @lucene.experimental
|
||||
*/
|
||||
public class MultiCLSearcher {
|
||||
|
||||
/** No instance */
|
||||
private MultiCLSearcher() {}
|
||||
|
||||
/**
|
||||
* Search an index with facets.
|
||||
|
@ -78,6 +81,18 @@ public class MultiCLSearcher {
|
|||
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,
|
||||
TaxonomyReader taxo, FacetIndexingParams iParams) throws Exception {
|
||||
// prepare searcher to search against
|
||||
|
|
|
@ -39,6 +39,9 @@ import org.apache.lucene.store.Directory;
|
|||
* @lucene.experimental
|
||||
*/
|
||||
public class SimpleIndexer {
|
||||
|
||||
/** No instance */
|
||||
private SimpleIndexer() {}
|
||||
|
||||
/**
|
||||
* Create an index, and adds to it sample documents and facets.
|
||||
|
|
|
@ -36,6 +36,9 @@ import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
|
|||
* @lucene.experimental
|
||||
*/
|
||||
public class SimpleMain {
|
||||
|
||||
/** Sole constructor */
|
||||
public SimpleMain() {}
|
||||
|
||||
/**
|
||||
* Driver for the simple sample.
|
||||
|
@ -47,6 +50,7 @@ public class SimpleMain {
|
|||
ExampleUtils.log("DONE");
|
||||
}
|
||||
|
||||
/** Runs the simple sample and returns the facet results */
|
||||
public ExampleResult runSimple() throws Exception {
|
||||
// create Directories for the search index and for the taxonomy index
|
||||
Directory indexDir = new RAMDirectory();
|
||||
|
@ -72,6 +76,7 @@ public class SimpleMain {
|
|||
return res;
|
||||
}
|
||||
|
||||
/** Runs the simple sample and returns drilldown results */
|
||||
public ExampleResult runDrillDown() throws Exception {
|
||||
// create Directories for the search index and for the taxonomy index
|
||||
Directory indexDir = new RAMDirectory();
|
||||
|
|
|
@ -47,6 +47,9 @@ import org.apache.lucene.search.TopScoreDocCollector;
|
|||
*/
|
||||
public class SimpleSearcher {
|
||||
|
||||
/** No instance */
|
||||
private SimpleSearcher() {}
|
||||
|
||||
/**
|
||||
* Search an index with facets.
|
||||
* @param indexReader index reader.
|
||||
|
|
|
@ -28,6 +28,9 @@ import org.apache.lucene.facet.taxonomy.CategoryPath;
|
|||
* @lucene.experimental
|
||||
*/
|
||||
public class SimpleUtils {
|
||||
|
||||
/** No instance */
|
||||
private SimpleUtils() {}
|
||||
|
||||
/**
|
||||
* Documents text field.
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.lucene.util.Version;
|
|||
*/
|
||||
|
||||
/**
|
||||
* Utility methods for merging index and taxonomy directories.
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class TaxonomyMergeUtils {
|
||||
|
|
Loading…
Reference in New Issue