diff --git a/lucene/build.xml b/lucene/build.xml
index 0c8f74c7624..b0f318831a9 100644
--- a/lucene/build.xml
+++ b/lucene/build.xml
@@ -257,7 +257,7 @@
-
+ suggestion
and
+ * an array of term ids (referencing the indexes to the original terms that
+ * form this combined suggestion)
+ */
public CombineSuggestion (SuggestWord suggestion, int[] originalTermIndexes) {
this.suggestion = suggestion;
this.originalTermIndexes = originalTermIndexes;
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/HighFrequencyDictionary.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/HighFrequencyDictionary.java
index 5a95f78a364..2a4b341d020 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/spell/HighFrequencyDictionary.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/HighFrequencyDictionary.java
@@ -42,6 +42,13 @@ public class HighFrequencyDictionary implements Dictionary {
private String field;
private float thresh;
+ /**
+ * Creates a new Dictionary, pulling source terms from
+ * the specified field
in the provided reader
.
+ *
+ * Terms appearing in less than thres
percentage of documents
+ * will be excluded.
+ */
public HighFrequencyDictionary(IndexReader reader, String field, float thresh) {
this.reader = reader;
this.field = field;
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/JaroWinklerDistance.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/JaroWinklerDistance.java
index f47cd147905..6b8eba269e6 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/spell/JaroWinklerDistance.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/JaroWinklerDistance.java
@@ -27,6 +27,13 @@ import java.util.Arrays;
public class JaroWinklerDistance implements StringDistance {
private float threshold = 0.7f;
+
+ /**
+ * Creates a new distance metric with the default threshold
+ * for the Jaro Winkler bonus (0.7)
+ * @see #setThreshold(float)
+ */
+ public JaroWinklerDistance() {}
private int[] matches(String s1, String s2) {
String max, min;
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java
index 9bfbda7a0e5..6bd77be91e2 100755
--- a/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java
@@ -27,14 +27,15 @@ import java.io.*;
/**
* Lucene Dictionary: terms taken from the given field
* of a Lucene index.
- *
- * When using IndexReader.terms(Term) the code must not call next() on TermEnum
- * as the first call to TermEnum, see: http://issues.apache.org/jira/browse/LUCENE-6
*/
public class LuceneDictionary implements Dictionary {
private IndexReader reader;
private String field;
+ /**
+ * Creates a new Dictionary, pulling source terms from
+ * the specified field
in the provided reader
+ */
public LuceneDictionary(IndexReader reader, String field) {
this.reader = reader;
this.field = field;
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneLevenshteinDistance.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneLevenshteinDistance.java
index d2326ebbe9e..c3d70aa2300 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneLevenshteinDistance.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneLevenshteinDistance.java
@@ -38,6 +38,12 @@ import org.apache.lucene.util.IntsRef;
* for merging results from multiple DirectSpellCheckers.
*/
public final class LuceneLevenshteinDistance implements StringDistance {
+
+ /**
+ * Creates a new comparator, mimicing the behavior of Lucene's internal
+ * edit distance.
+ */
+ public LuceneLevenshteinDistance() {}
@Override
public float getDistance(String target, String other) {
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java
index 6d7a0c54577..ff4360ad6ae 100755
--- a/lucene/suggest/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java
@@ -38,10 +38,20 @@ public class PlainTextDictionary implements Dictionary {
private BufferedReader in;
+ /**
+ * Creates a dictionary based on a File.
+ *
+ * NOTE: content is treated as UTF-8 + */ public PlainTextDictionary(File file) throws IOException { in = new BufferedReader(IOUtils.getDecodingReader(file, IOUtils.CHARSET_UTF_8)); } + /** + * Creates a dictionary based on an inputstream. + *
+ * NOTE: content is treated as UTF-8
+ */
public PlainTextDictionary(InputStream dictFile) {
in = new BufferedReader(IOUtils.getDecodingReader(dictFile, IOUtils.CHARSET_UTF_8));
}
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/SuggestWord.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/SuggestWord.java
index da17f8f6706..994cd33e393 100755
--- a/lucene/suggest/src/java/org/apache/lucene/search/spell/SuggestWord.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/SuggestWord.java
@@ -27,6 +27,11 @@ package org.apache.lucene.search.spell;
*/
public final class SuggestWord{
+ /**
+ * Creates a new empty suggestion with null text.
+ */
+ public SuggestWord() {}
+
/**
* the score of the word
*/
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/SuggestWordFrequencyComparator.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/SuggestWordFrequencyComparator.java
index 1abb5c61c1b..4d40c5d4573 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/spell/SuggestWordFrequencyComparator.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/SuggestWordFrequencyComparator.java
@@ -20,10 +20,16 @@ import java.util.Comparator;
/**
- * Frequency first, then score. Must have
+ * Frequency first, then score.
*
**/
public class SuggestWordFrequencyComparator implements Comparator
* Determines the order to list word break suggestions
@@ -347,22 +358,43 @@ public class WordBreakSpellChecker {
return word;
}
+ /**
+ * Returns the minimum frequency a term must have
+ * to be part of a suggestion.
+ * @see #setMinSuggestionFrequency(int)
+ */
public int getMinSuggestionFrequency() {
return minSuggestionFrequency;
}
+ /**
+ * Returns the maximum length of a combined suggestion
+ * @see #setMaxCombineWordLength(int)
+ */
public int getMaxCombineWordLength() {
return maxCombineWordLength;
}
+ /**
+ * Returns the minimum size of a broken word
+ * @see #setMinBreakWordLength(int)
+ */
public int getMinBreakWordLength() {
return minBreakWordLength;
}
+ /**
+ * Returns the maximum number of changes to perform on the input
+ * @see #setMaxChanges(int)
+ */
public int getMaxChanges() {
return maxChanges;
}
+ /**
+ * Returns the maximum number of word combinations to evaluate.
+ * @see #setMaxEvaluations(int)
+ */
public int getMaxEvaluations() {
return maxEvaluations;
}
@@ -374,7 +406,7 @@ public class WordBreakSpellChecker {
* {@link SuggestMode#SUGGEST_MORE_POPULAR}
* 1
for all terms.
+ */
public TermFreqIteratorWrapper(BytesRefIterator wrapped) {
this.wrapped = wrapped;
}
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/WordBreakSpellChecker.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/WordBreakSpellChecker.java
index 40f4d6382c3..d9675a17471 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/spell/WordBreakSpellChecker.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/WordBreakSpellChecker.java
@@ -40,8 +40,19 @@ public class WordBreakSpellChecker {
private int maxChanges = 1;
private int maxEvaluations = 1000;
+ /** Term that can be used to prohibit adjacent terms from being combined */
public static final Term SEPARATOR_TERM = new Term("", "");
+ /**
+ * Creates a new spellchecker with default configuration values
+ * @see #setMaxChanges(int)
+ * @see #setMaxCombineWordLength(int)
+ * @see #setMaxEvaluations(int)
+ * @see #setMinBreakWordLength(int)
+ * @see #setMinSuggestionFrequency(int)
+ */
+ public WordBreakSpellChecker() {}
+
/**
*
+ * NOTE: content is treated as UTF-8
+ */
public FileDictionary(InputStream dictFile) {
in = new BufferedReader(IOUtils.getDecodingReader(dictFile, IOUtils.CHARSET_UTF_8));
}
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/Lookup.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/Lookup.java
index 24cfb5a3422..88e4f486410 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/Lookup.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/Lookup.java
@@ -37,9 +37,14 @@ public abstract class Lookup {
* Result of a lookup.
*/
public static final class LookupResult implements Comparable
+ * This method always returns false.
+ */
public boolean add(CharSequence key, Object value) {
trie.put(key, value);
// XXX
return false;
}
+ /**
+ * Returns the value for the specified key, or null
+ * if the key does not exist.
+ */
public Object get(CharSequence key) {
return trie.get(key);
}
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java
index 3031552eb18..c61d3442216 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java
@@ -160,6 +160,10 @@ public class JaspellTernarySearchTrie {
this(Locale.ROOT);
}
+ /**
+ * Constructs an empty Ternary Search Trie,
+ * specifying the Locale used for lowercasing.
+ */
public JaspellTernarySearchTrie(Locale locale) {
this.locale = locale;
}
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java
index 3f4b056ad45..d18840292ae 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java
@@ -25,6 +25,8 @@ import java.util.*;
* @see TernaryTreeNode
*/
public class TSTAutocomplete {
+
+ TSTAutocomplete() {}
/**
* Inserting keys in TST in the order middle,small,big (lexicographic measure)
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java
index 6d150329540..6ba8cf08bd1 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java
@@ -42,6 +42,12 @@ import org.apache.lucene.util.UnicodeUtil;
public class TSTLookup extends Lookup {
TernaryTreeNode root = new TernaryTreeNode();
TSTAutocomplete autocomplete = new TSTAutocomplete();
+
+ /**
+ * Creates a new TSTLookup with an empty Ternary Search Tree.
+ * @see #build(TermFreqIterator)
+ */
+ public TSTLookup() {}
@Override
public void build(TermFreqIterator tfit) throws IOException {
@@ -65,12 +71,22 @@ public class TSTLookup extends Lookup {
autocomplete.balancedTree(tokens.toArray(), vals.toArray(), 0, tokens.size() - 1, root);
}
+ /**
+ * Adds a new node if
+ * This method always returns true.
+ */
public boolean add(CharSequence key, Object value) {
autocomplete.insert(root, key, value, 0);
// XXX we don't know if a new node was created
return true;
}
+ /**
+ * Returns the value for the specified key, or null
+ * if the key does not exist.
+ */
public Object get(CharSequence key) {
ListcompareRawBytes
is true, then
+ * only the bytes (not the weight) will be used for comparison.
+ */
public SortedTermFreqIteratorWrapper(TermFreqIterator source, Comparatorkey
already exists,
+ * otherwise replaces its value.
+ * key
already exists,
+ * otherwise replaces its value.
+ *