lucene 4: Fixed TermFactory usage in MapperService

This commit is contained in:
Chris Male 2012-10-31 11:13:10 +13:00 committed by Shay Banon
parent 0354825914
commit b3e59d58e4
2 changed files with 4 additions and 5 deletions

View File

@ -20,10 +20,10 @@
package org.elasticsearch.common.lucene.search; package org.elasticsearch.common.lucene.search;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.queries.FilterClause;
import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.Filter; import org.apache.lucene.search.Filter;
import org.apache.lucene.search.FilterClause;
import org.apache.lucene.util.FixedBitSet; import org.apache.lucene.util.FixedBitSet;
import org.elasticsearch.common.lucene.docset.DocSet; import org.elasticsearch.common.lucene.docset.DocSet;
import org.elasticsearch.common.lucene.docset.DocSets; import org.elasticsearch.common.lucene.docset.DocSets;

View File

@ -26,11 +26,10 @@ import com.google.common.collect.Sets;
import com.google.common.collect.UnmodifiableIterator; import com.google.common.collect.UnmodifiableIterator;
import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.queries.FilterClause;
import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.Filter; import org.apache.lucene.search.Filter;
import org.apache.lucene.search.FilterClause;
import org.apache.lucene.search.XTermsFilter; import org.apache.lucene.search.XTermsFilter;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.collect.MapBuilder;
@ -436,7 +435,7 @@ public class MapperService extends AbstractIndexComponent implements Iterable<Do
if (useTermsFilter) { if (useTermsFilter) {
Term[] typesTerms = new Term[types.length]; Term[] typesTerms = new Term[types.length];
for (int i = 0; i < typesTerms.length; i++) { for (int i = 0; i < typesTerms.length; i++) {
typesTerms[i] = TypeFieldMapper.TERM_FACTORY.createTerm(types[i]); typesTerms[i] = new Term(TypeFieldMapper.NAME, types[i]);
} }
return new XTermsFilter(typesTerms); return new XTermsFilter(typesTerms);
} else { } else {
@ -444,7 +443,7 @@ public class MapperService extends AbstractIndexComponent implements Iterable<Do
for (String type : types) { for (String type : types) {
DocumentMapper docMapper = documentMapper(type); DocumentMapper docMapper = documentMapper(type);
if (docMapper == null) { if (docMapper == null) {
bool.add(new FilterClause(new TermFilter(TypeFieldMapper.TERM_FACTORY.createTerm(type)), BooleanClause.Occur.SHOULD)); bool.add(new FilterClause(new TermFilter(new Term(TypeFieldMapper.NAME, type)), BooleanClause.Occur.SHOULD));
} else { } else {
bool.add(new FilterClause(docMapper.typeFilter(), BooleanClause.Occur.SHOULD)); bool.add(new FilterClause(docMapper.typeFilter(), BooleanClause.Occur.SHOULD));
} }