LUCENE-5339: handle warnings and javadoc errors

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5339@1554372 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shai Erera 2013-12-31 06:50:24 +00:00
parent 0699ac7d42
commit d2c4dfca04
18 changed files with 39 additions and 76 deletions

View File

@ -23,15 +23,14 @@ import java.util.List;
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.facet.Facets;
import org.apache.lucene.facet.FacetsConfig;
import org.apache.lucene.facet.DrillDownQuery;
import org.apache.lucene.facet.FacetResult;
import org.apache.lucene.facet.Facets;
import org.apache.lucene.facet.FacetsCollector;
import org.apache.lucene.facet.FacetsConfig;
import org.apache.lucene.facet.SortedSetDocValuesFacetCounts;
import org.apache.lucene.facet.SortedSetDocValuesFacetField;
import org.apache.lucene.facet.SortedSetDocValuesReaderState;
import org.apache.lucene.facet.taxonomy.FacetLabel;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
@ -41,8 +40,8 @@ import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
/** Shows simple usage of faceted indexing and search,
* using {@link SortedSetDocValuesFacetFields} and {@link
* SortedSetDocValuesAccumulator}. */
* using {@link SortedSetDocValuesFacetField} and {@link
* SortedSetDocValuesFacetCounts}. */
public class SimpleSortedSetFacetsExample {

View File

@ -34,6 +34,7 @@ import org.apache.lucene.util.BytesRef;
*
* @lucene.experimental */
public class AssociationFacetField extends Field {
static final FieldType TYPE = new FieldType();
static {
TYPE.setIndexed(true);
@ -55,15 +56,15 @@ public class AssociationFacetField extends Field {
this.path = path;
}
private static BytesRef intToBytesRef(int v) {
byte[] bytes = new byte[4];
// big-endian:
bytes[0] = (byte) (v >> 24);
bytes[1] = (byte) (v >> 16);
bytes[2] = (byte) (v >> 8);
bytes[3] = (byte) v;
return new BytesRef(bytes);
}
// private static BytesRef intToBytesRef(int v) {
// byte[] bytes = new byte[4];
// // big-endian:
// bytes[0] = (byte) (v >> 24);
// bytes[1] = (byte) (v >> 16);
// bytes[2] = (byte) (v >> 8);
// bytes[3] = (byte) v;
// return new BytesRef(bytes);
// }
@Override
public String toString() {

View File

@ -21,11 +21,10 @@ import java.io.IOException;
import java.util.Map;
import java.util.WeakHashMap;
import org.apache.lucene.codecs.DocValuesFormat; // javadocs
import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.BinaryDocValues; // javadocs
import org.apache.lucene.index.BinaryDocValues;
import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IntsRef;
import org.apache.lucene.util.RamUsageEstimator;
@ -104,8 +103,6 @@ public class CachedOrdinalsReader extends OrdinalsReader {
* Assumes that the {@link BinaryDocValues} is not {@code null}.
*/
public CachedOrds(OrdinalsSegmentReader source, int maxDoc) throws IOException {
final BytesRef buf = new BytesRef();
offsets = new int[maxDoc + 1];
int[] ords = new int[maxDoc]; // let's assume one ordinal per-document as an initial size

View File

@ -20,13 +20,13 @@ package org.apache.lucene.facet;
import java.io.IOException;
import java.util.Collections;
import org.apache.lucene.document.DoubleDocValuesField; // javadocs
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.queries.function.FunctionValues;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Filter;
import org.apache.lucene.search.NumericRangeFilter;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.NumericUtils;

View File

@ -18,22 +18,20 @@ package org.apache.lucene.facet;
*/
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.lucene.facet.taxonomy.FacetLabel;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.ConstantScoreQuery;
import org.apache.lucene.search.Filter;
import org.apache.lucene.search.FilteredQuery;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.search.NumericRangeQuery; // javadocs
import org.apache.lucene.search.NumericRangeQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;

View File

@ -18,13 +18,8 @@ package org.apache.lucene.facet;
*/
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.lucene.facet.taxonomy.TaxonomyReader;
import org.apache.lucene.index.IndexReader;
@ -161,10 +156,8 @@ public class DrillSideways {
}
FacetsCollector[] drillSidewaysCollectors = new FacetsCollector[drillDownDims.size()];
int idx = 0;
for(String dim : drillDownDims.keySet()) {
drillSidewaysCollectors[idx++] = new FacetsCollector();
for (int i = 0; i < drillSidewaysCollectors.length; i++) {
drillSidewaysCollectors[i] = new FacetsCollector();
}
boolean useCollectorMethod = scoreSubDocsAtOnce();

View File

@ -20,24 +20,11 @@ package org.apache.lucene.facet;
import java.io.IOException;
import java.util.List;
import org.apache.lucene.search.FieldDoc;
import org.apache.lucene.search.Filter;
import org.apache.lucene.search.FilteredQuery;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.MultiCollector;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.TopDocsCollector;
import org.apache.lucene.search.TopFieldCollector;
import org.apache.lucene.search.TopFieldDocs;
import org.apache.lucene.search.TopScoreDocCollector;
/** Common base class for all facets implementations.
*
* @lucene.experimental */
public abstract class Facets {
/** Returns the topN child labels under the specified
* path. Returns null if the specified path doesn't
* exist or if this dimension was never seen. */

View File

@ -21,10 +21,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.lucene.facet.taxonomy.FacetLabel;
import org.apache.lucene.facet.taxonomy.TaxonomyReader;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.Collector;
import org.apache.lucene.search.FieldDoc;
import org.apache.lucene.search.Filter;
@ -193,7 +190,7 @@ public final class FacetsCollector extends Collector {
if (sort == null) {
throw new IllegalArgumentException("sort must not be null");
}
return (TopFieldDocs) doSearch(searcher, after, q, filter, n, sort, false, false, fc);
return doSearch(searcher, after, q, filter, n, sort, false, false, fc);
}
/** Utility method, to search and also collect all hits
@ -202,7 +199,7 @@ public final class FacetsCollector extends Collector {
if (sort == null) {
throw new IllegalArgumentException("sort must not be null");
}
return (TopFieldDocs) doSearch(searcher, after, q, filter, n, sort, doDocScores, doMaxScore, fc);
return doSearch(searcher, after, q, filter, n, sort, doDocScores, doMaxScore, fc);
}
private static TopDocs doSearch(IndexSearcher searcher, ScoreDoc after, Query q, Filter filter, int n, Sort sort,

View File

@ -469,7 +469,7 @@ public class FacetsConfig {
return pathToString(path, path.length);
}
/** Turns the first {@code} length elements of {@code
/** Turns the first {@code length} elements of {@code
* path} into an encoded string. */
public static String pathToString(String[] path, int length) {
if (length == 0) {

View File

@ -19,9 +19,7 @@ package org.apache.lucene.facet;
import java.util.Arrays;
import org.apache.lucene.document.Document; // javadocs
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.Document;
import org.apache.lucene.util.BytesRef;
/** Add an instance of this to your {@link Document} to add

View File

@ -19,9 +19,7 @@ package org.apache.lucene.facet;
import java.util.Arrays;
import org.apache.lucene.document.Document; // javadocs
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.Document;
import org.apache.lucene.util.BytesRef;
/** Add an instance of this to your {@link Document} to add

View File

@ -20,13 +20,13 @@ package org.apache.lucene.facet;
import java.io.IOException;
import java.util.Collections;
import org.apache.lucene.document.NumericDocValuesField; // javadocs
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.queries.function.FunctionValues;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Filter;
import org.apache.lucene.search.NumericRangeFilter;
import org.apache.lucene.util.Bits;
/** Represents a range over long values. */

View File

@ -18,7 +18,6 @@ package org.apache.lucene.facet;
*/
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@ -153,7 +152,6 @@ final class LongRangeCounter {
int lo = 0;
int hi = boundaries.length - 1;
int count = 0;
while (true) {
int mid = (lo + hi) >>> 1;
//System.out.println(" cycle lo=" + lo + " hi=" + hi + " mid=" + mid + " boundary=" + boundaries[mid] + " to " + boundaries[mid+1]);

View File

@ -28,7 +28,7 @@ public class MultiFacets extends Facets {
private final Facets defaultFacets;
public MultiFacets(Map<String,Facets> dimToFacets) {
this(dimToFacets = dimToFacets, null);
this(dimToFacets, null);
}
public MultiFacets(Map<String,Facets> dimToFacets, Facets defaultFacets) {
@ -36,6 +36,7 @@ public class MultiFacets extends Facets {
this.defaultFacets = defaultFacets;
}
@Override
public FacetResult getTopChildren(int topN, String dim, String... path) throws IOException {
Facets facets = dimToFacets.get(dim);
if (facets == null) {
@ -47,6 +48,7 @@ public class MultiFacets extends Facets {
return facets.getTopChildren(topN, dim, path);
}
@Override
public Number getSpecificValue(String dim, String... path) throws IOException {
Facets facets = dimToFacets.get(dim);
if (facets == null) {
@ -58,6 +60,7 @@ public class MultiFacets extends Facets {
return facets.getSpecificValue(dim, path);
}
@Override
public List<FacetResult> getAllDims(int topN) throws IOException {
// TODO
throw new UnsupportedOperationException();

View File

@ -21,6 +21,8 @@ import java.io.IOException;
import java.util.Collections;
import java.util.List;
import org.apache.lucene.queries.function.valuesource.LongFieldSource;
/** Base class for range faceting.
*

View File

@ -17,8 +17,6 @@ package org.apache.lucene.facet;
* limitations under the License.
*/
import java.util.Arrays;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;

View File

@ -21,10 +21,8 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.CompositeReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.SlowCompositeReaderWrapper;
import org.apache.lucene.index.SortedSetDocValues;

View File

@ -17,10 +17,12 @@ package org.apache.lucene.facet.taxonomy;
* limitations under the License.
*/
import static org.apache.lucene.util.ByteBlockPool.BYTE_BLOCK_SIZE;
import java.util.Arrays;
import static org.apache.lucene.util.ByteBlockPool.BYTE_BLOCK_SIZE;
import org.apache.lucene.facet.taxonomy.writercache.LruTaxonomyWriterCache;
import org.apache.lucene.facet.taxonomy.writercache.NameHashIntCacheLRU;
/**
* Holds a sequence of string components, specifying the hierarchical name of a
@ -31,7 +33,7 @@ import static org.apache.lucene.util.ByteBlockPool.BYTE_BLOCK_SIZE;
public class FacetLabel implements Comparable<FacetLabel> {
/*
* copied from DocumentWriterPerThread -- if a CategoryPath is resolved to a
* copied from DocumentWriterPerThread -- if a FacetLabel is resolved to a
* drill-down term which is encoded to a larger term than that length, it is
* silently dropped! Therefore we limit the number of characters to MAX/4 to
* be on the safe side.
@ -52,12 +54,6 @@ public class FacetLabel implements Comparable<FacetLabel> {
/** The number of components of this {@link FacetLabel}. */
public final int length;
// Used by singleton EMPTY
private FacetLabel() {
components = null;
length = 0;
}
// Used by subpath
private FacetLabel(final FacetLabel copyFrom, final int prefixLen) {
// while the code which calls this method is safe, at some point a test