mirror of https://github.com/apache/lucene.git
LUCENE-3306: disable positions for spellchecker ngram fields
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1145957 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dddbb9c0a0
commit
bbd85816c8
|
@ -85,6 +85,12 @@ API Changes
|
|||
constructors. PKIndexSplitter accepts a IndexWriterConfig for each of
|
||||
the target indexes. (Simon Willnauer, Jason Rutherglen)
|
||||
|
||||
Optimizations
|
||||
|
||||
* LUCENE-3306: Disabled indexing of positions for spellchecker n-gram
|
||||
fields: they are not needed because the spellchecker does not
|
||||
use positional queries. (Robert Muir)
|
||||
|
||||
Bug Fixes
|
||||
|
||||
|
||||
|
|
|
@ -633,7 +633,11 @@ public class SpellChecker implements java.io.Closeable {
|
|||
String end = null;
|
||||
for (int i = 0; i < len - ng + 1; i++) {
|
||||
String gram = text.substring(i, i + ng);
|
||||
doc.add(new Field(key, gram, Field.Store.NO, Field.Index.NOT_ANALYZED));
|
||||
Field ngramField = new Field(key, gram, Field.Store.NO, Field.Index.NOT_ANALYZED);
|
||||
// spellchecker does not use positional queries, but we want freqs
|
||||
// for scoring these multivalued n-gram fields.
|
||||
ngramField.setIndexOptions(IndexOptions.DOCS_AND_FREQS);
|
||||
doc.add(ngramField);
|
||||
if (i == 0) {
|
||||
// only one term possible in the startXXField, TF/pos and norms aren't needed.
|
||||
Field startField = new Field("start" + ng, gram, Field.Store.NO, Field.Index.NOT_ANALYZED);
|
||||
|
|
Loading…
Reference in New Issue