Add missing license headers, move package names after license headers
This commit is contained in:
parent
2b49ec138c
commit
b9aaa79afd
|
@ -1,5 +1,3 @@
|
||||||
package org.apache.lucene.index.memory;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -19,6 +17,8 @@ package org.apache.lucene.index.memory;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.apache.lucene.index.memory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class overwrites {@link MemoryIndex} to make the reuse constructor visible.
|
* This class overwrites {@link MemoryIndex} to make the reuse constructor visible.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.apache.lucene.queries;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -17,11 +16,14 @@ package org.apache.lucene.queries;
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.apache.lucene.queries;
|
||||||
|
|
||||||
import org.apache.lucene.search.BooleanClause.Occur;
|
import org.apache.lucene.search.BooleanClause.Occur;
|
||||||
import org.elasticsearch.common.lucene.search.Queries;
|
import org.elasticsearch.common.lucene.search.Queries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extended version of {@link CommonTermsQuery} that allows to pass in a
|
* Extended version of {@link CommonTermsQuery} that allows to pass in a
|
||||||
* <tt>minimumNumberShouldMatch</tt> specification that uses the actual num of high frequent terms
|
* <tt>minimumNumberShouldMatch</tt> specification that uses the actual num of high frequent terms
|
||||||
* to calculate the minimum matching terms.
|
* to calculate the minimum matching terms.
|
||||||
*/
|
*/
|
||||||
|
@ -34,7 +36,7 @@ public class ExtendedCommonTermsQuery extends CommonTermsQuery {
|
||||||
public ExtendedCommonTermsQuery(Occur highFreqOccur, Occur lowFreqOccur, float maxTermFrequency) {
|
public ExtendedCommonTermsQuery(Occur highFreqOccur, Occur lowFreqOccur, float maxTermFrequency) {
|
||||||
super(highFreqOccur, lowFreqOccur, maxTermFrequency);
|
super(highFreqOccur, lowFreqOccur, maxTermFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String lowFreqMinNumShouldMatchSpec;
|
private String lowFreqMinNumShouldMatchSpec;
|
||||||
private String highFreqMinNumShouldMatchSpec;
|
private String highFreqMinNumShouldMatchSpec;
|
||||||
|
|
||||||
|
@ -54,7 +56,7 @@ public class ExtendedCommonTermsQuery extends CommonTermsQuery {
|
||||||
protected int calcHighFreqMinimumNumberShouldMatch(int numOptional) {
|
protected int calcHighFreqMinimumNumberShouldMatch(int numOptional) {
|
||||||
return calcMinimumNumberShouldMatch(highFreqMinNumShouldMatchSpec, numOptional);
|
return calcMinimumNumberShouldMatch(highFreqMinNumShouldMatchSpec, numOptional);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHighFreqMinimumNumberShouldMatch(String spec) {
|
public void setHighFreqMinimumNumberShouldMatch(String spec) {
|
||||||
this.highFreqMinNumShouldMatchSpec = spec;
|
this.highFreqMinNumShouldMatchSpec = spec;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.action.admin.cluster.stats;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,7 @@ package org.elasticsearch.action.admin.cluster.stats;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.action.admin.cluster.stats;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.ObjectObjectOpenHashMap;
|
import com.carrotsearch.hppc.ObjectObjectOpenHashMap;
|
||||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||||
|
@ -249,17 +249,23 @@ public class ClusterStatsIndices implements ToXContent, Streamable {
|
||||||
return (((double) (total - primaries)) / primaries);
|
return (((double) (total - primaries)) / primaries);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the maximum number of shards (primary+replicas) an index has */
|
/**
|
||||||
|
* the maximum number of shards (primary+replicas) an index has
|
||||||
|
*/
|
||||||
public int getMaxIndexShards() {
|
public int getMaxIndexShards() {
|
||||||
return this.maxIndexShards;
|
return this.maxIndexShards;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the minimum number of shards (primary+replicas) an index has */
|
/**
|
||||||
|
* the minimum number of shards (primary+replicas) an index has
|
||||||
|
*/
|
||||||
public int getMinIndexShards() {
|
public int getMinIndexShards() {
|
||||||
return this.minIndexShards;
|
return this.minIndexShards;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** average number of shards (primary+replicas) across the indices */
|
/**
|
||||||
|
* average number of shards (primary+replicas) across the indices
|
||||||
|
*/
|
||||||
public double getAvgIndexShards() {
|
public double getAvgIndexShards() {
|
||||||
if (this.indices == 0) {
|
if (this.indices == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -274,12 +280,16 @@ public class ClusterStatsIndices implements ToXContent, Streamable {
|
||||||
return this.maxIndexPrimaryShards;
|
return this.maxIndexPrimaryShards;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the minimum number of primary shards an index has */
|
/**
|
||||||
|
* the minimum number of primary shards an index has
|
||||||
|
*/
|
||||||
public int getMinIndexPrimaryShards() {
|
public int getMinIndexPrimaryShards() {
|
||||||
return this.minIndexPrimaryShards;
|
return this.minIndexPrimaryShards;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the average number primary shards across the indices */
|
/**
|
||||||
|
* the average number primary shards across the indices
|
||||||
|
*/
|
||||||
public double getAvgIndexPrimaryShards() {
|
public double getAvgIndexPrimaryShards() {
|
||||||
if (this.indices == 0) {
|
if (this.indices == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.action.admin.cluster.stats;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,7 @@ package org.elasticsearch.action.admin.cluster.stats;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.action.admin.cluster.stats;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.ObjectIntOpenHashMap;
|
import com.carrotsearch.hppc.ObjectIntOpenHashMap;
|
||||||
import com.carrotsearch.hppc.cursors.ObjectIntCursor;
|
import com.carrotsearch.hppc.cursors.ObjectIntCursor;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
package org.elasticsearch.action.termvector;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -19,6 +17,8 @@ package org.elasticsearch.action.termvector;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.action.termvector;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchIllegalArgumentException;
|
import org.elasticsearch.ElasticsearchIllegalArgumentException;
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
import org.elasticsearch.action.ActionRequest;
|
import org.elasticsearch.action.ActionRequest;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.action.termvector;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,7 @@ package org.elasticsearch.action.termvector;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.action.termvector;
|
||||||
|
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.action.ActionRequestBuilder;
|
import org.elasticsearch.action.ActionRequestBuilder;
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.action.update;
|
package org.elasticsearch.action.update;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchIllegalArgumentException;
|
import org.elasticsearch.ElasticsearchIllegalArgumentException;
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.common.collect;
|
package org.elasticsearch.common.collect;
|
||||||
|
|
||||||
import com.carrotsearch.hppc.ObjectIntOpenHashMap;
|
import com.carrotsearch.hppc.ObjectIntOpenHashMap;
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.common.joda;
|
package org.elasticsearch.common.joda;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.index.analysis;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -17,9 +16,8 @@ package org.elasticsearch.index.analysis;
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
package org.elasticsearch.index.analysis;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.lucene.analysis.TokenStream;
|
import org.apache.lucene.analysis.TokenStream;
|
||||||
import org.apache.lucene.analysis.cjk.CJKBigramFilter;
|
import org.apache.lucene.analysis.cjk.CJKBigramFilter;
|
||||||
|
@ -29,18 +27,22 @@ import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.settings.IndexSettings;
|
import org.elasticsearch.index.settings.IndexSettings;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory that creates a {@link CJKBigramFilter} to form bigrams of CJK terms
|
* Factory that creates a {@link CJKBigramFilter} to form bigrams of CJK terms
|
||||||
* that are generated from StandardTokenizer or ICUTokenizer.
|
* that are generated from StandardTokenizer or ICUTokenizer.
|
||||||
* <p>
|
* <p/>
|
||||||
* CJK types are set by these tokenizers, but you can also use flags to
|
* CJK types are set by these tokenizers, but you can also use flags to
|
||||||
* explicitly control which of the CJK scripts are turned into bigrams.
|
* explicitly control which of the CJK scripts are turned into bigrams.
|
||||||
* <p>
|
* <p/>
|
||||||
* By default, when a CJK character has no adjacent characters to form a bigram,
|
* By default, when a CJK character has no adjacent characters to form a bigram,
|
||||||
* it is output in unigram form. If you want to always output both unigrams and
|
* it is output in unigram form. If you want to always output both unigrams and
|
||||||
* bigrams, set the <code>outputUnigrams</code> flag. This can be used for a
|
* bigrams, set the <code>outputUnigrams</code> flag. This can be used for a
|
||||||
* combined unigram+bigram approach.
|
* combined unigram+bigram approach.
|
||||||
* <p>
|
* <p/>
|
||||||
* In all cases, all non-CJK input is passed thru unmodified.
|
* In all cases, all non-CJK input is passed thru unmodified.
|
||||||
*/
|
*/
|
||||||
public final class CJKBigramFilterFactory extends AbstractTokenFilterFactory {
|
public final class CJKBigramFilterFactory extends AbstractTokenFilterFactory {
|
||||||
|
@ -63,11 +65,11 @@ public final class CJKBigramFilterFactory extends AbstractTokenFilterFactory {
|
||||||
flags |= CJKBigramFilter.HAN;
|
flags |= CJKBigramFilter.HAN;
|
||||||
} else if ("hiragana".equals(script)) {
|
} else if ("hiragana".equals(script)) {
|
||||||
flags |= CJKBigramFilter.HIRAGANA;
|
flags |= CJKBigramFilter.HIRAGANA;
|
||||||
} else if("katakana".equals(script)) {
|
} else if ("katakana".equals(script)) {
|
||||||
flags |= CJKBigramFilter.KATAKANA;
|
flags |= CJKBigramFilter.KATAKANA;
|
||||||
} else if("hangul".equals(script)) {
|
} else if ("hangul".equals(script)) {
|
||||||
flags |= CJKBigramFilter.HANGUL;
|
flags |= CJKBigramFilter.HANGUL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.flags = flags;
|
this.flags = flags;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.index.analysis;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -17,6 +16,9 @@ package org.elasticsearch.index.analysis;
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.index.analysis;
|
||||||
|
|
||||||
import org.apache.lucene.analysis.TokenStream;
|
import org.apache.lucene.analysis.TokenStream;
|
||||||
import org.apache.lucene.analysis.cjk.CJKWidthFilter;
|
import org.apache.lucene.analysis.cjk.CJKWidthFilter;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.index.analysis;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,8 @@ package org.elasticsearch.index.analysis;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.index.analysis;
|
||||||
|
|
||||||
import org.apache.lucene.analysis.TokenStream;
|
import org.apache.lucene.analysis.TokenStream;
|
||||||
import org.apache.lucene.analysis.miscellaneous.KeepWordFilter;
|
import org.apache.lucene.analysis.miscellaneous.KeepWordFilter;
|
||||||
import org.apache.lucene.analysis.util.CharArraySet;
|
import org.apache.lucene.analysis.util.CharArraySet;
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.index.fielddata;
|
package org.elasticsearch.index.fielddata;
|
||||||
|
|
||||||
import org.apache.lucene.index.AtomicReaderContext;
|
import org.apache.lucene.index.AtomicReaderContext;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.index.fielddata.fieldcomparator;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,8 @@ package org.elasticsearch.index.fielddata.fieldcomparator;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.index.fielddata.fieldcomparator;
|
||||||
|
|
||||||
import org.apache.lucene.index.AtomicReaderContext;
|
import org.apache.lucene.index.AtomicReaderContext;
|
||||||
import org.apache.lucene.search.FieldComparator;
|
import org.apache.lucene.search.FieldComparator;
|
||||||
import org.elasticsearch.index.fielddata.DoubleValues;
|
import org.elasticsearch.index.fielddata.DoubleValues;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.index.fielddata.fieldcomparator;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,8 @@ package org.elasticsearch.index.fielddata.fieldcomparator;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.index.fielddata.fieldcomparator;
|
||||||
|
|
||||||
import org.apache.lucene.index.AtomicReaderContext;
|
import org.apache.lucene.index.AtomicReaderContext;
|
||||||
import org.apache.lucene.search.FieldComparator;
|
import org.apache.lucene.search.FieldComparator;
|
||||||
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.index.percolator;
|
package org.elasticsearch.index.percolator;
|
||||||
|
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
package org.elasticsearch.index.query;
|
package org.elasticsearch.index.query;
|
||||||
|
|
||||||
import org.apache.lucene.queryparser.XSimpleQueryParser;
|
import org.apache.lucene.queryparser.XSimpleQueryParser;
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.percolator;
|
package org.elasticsearch.percolator;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchException;
|
import org.elasticsearch.ElasticsearchException;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.search.rescore;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -17,6 +16,9 @@ package org.elasticsearch.search.rescore;
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.search.rescore;
|
||||||
|
|
||||||
import org.apache.lucene.index.AtomicReaderContext;
|
import org.apache.lucene.index.AtomicReaderContext;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.search.*;
|
import org.apache.lucene.search.*;
|
||||||
|
@ -41,6 +43,7 @@ public final class QueryRescorer implements Rescorer {
|
||||||
public float combine(float primary, float secondary) {
|
public float combine(float primary, float secondary) {
|
||||||
return (primary + secondary) / 2;
|
return (primary + secondary) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "avg";
|
return "avg";
|
||||||
|
@ -51,6 +54,7 @@ public final class QueryRescorer implements Rescorer {
|
||||||
public float combine(float primary, float secondary) {
|
public float combine(float primary, float secondary) {
|
||||||
return Math.max(primary, secondary);
|
return Math.max(primary, secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "max";
|
return "max";
|
||||||
|
@ -61,6 +65,7 @@ public final class QueryRescorer implements Rescorer {
|
||||||
public float combine(float primary, float secondary) {
|
public float combine(float primary, float secondary) {
|
||||||
return Math.min(primary, secondary);
|
return Math.min(primary, secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "min";
|
return "min";
|
||||||
|
@ -71,6 +76,7 @@ public final class QueryRescorer implements Rescorer {
|
||||||
public float combine(float primary, float secondary) {
|
public float combine(float primary, float secondary) {
|
||||||
return primary + secondary;
|
return primary + secondary;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "sum";
|
return "sum";
|
||||||
|
@ -81,6 +87,7 @@ public final class QueryRescorer implements Rescorer {
|
||||||
public float combine(float primary, float secondary) {
|
public float combine(float primary, float secondary) {
|
||||||
return primary * secondary;
|
return primary * secondary;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "product";
|
return "product";
|
||||||
|
@ -99,7 +106,7 @@ public final class QueryRescorer implements Rescorer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rescore(TopDocs topDocs, SearchContext context, RescoreSearchContext rescoreContext) throws IOException{
|
public void rescore(TopDocs topDocs, SearchContext context, RescoreSearchContext rescoreContext) throws IOException {
|
||||||
assert rescoreContext != null;
|
assert rescoreContext != null;
|
||||||
QueryRescoreContext rescore = ((QueryRescoreContext) rescoreContext);
|
QueryRescoreContext rescore = ((QueryRescoreContext) rescoreContext);
|
||||||
TopDocs queryTopDocs = context.queryResult().topDocs();
|
TopDocs queryTopDocs = context.queryResult().topDocs();
|
||||||
|
@ -119,7 +126,7 @@ public final class QueryRescorer implements Rescorer {
|
||||||
Explanation primaryExplain = searcher.explain(context.query(), topLevelDocId);
|
Explanation primaryExplain = searcher.explain(context.query(), topLevelDocId);
|
||||||
if (primaryExplain == null) {
|
if (primaryExplain == null) {
|
||||||
// this should not happen but just in case
|
// this should not happen but just in case
|
||||||
return new ComplexExplanation(false, 0.0f, "nothing matched");
|
return new ComplexExplanation(false, 0.0f, "nothing matched");
|
||||||
}
|
}
|
||||||
Explanation rescoreExplain = searcher.explain(rescore.query(), topLevelDocId);
|
Explanation rescoreExplain = searcher.explain(rescore.query(), topLevelDocId);
|
||||||
float primaryWeight = rescore.queryWeight();
|
float primaryWeight = rescore.queryWeight();
|
||||||
|
@ -161,9 +168,9 @@ public final class QueryRescorer implements Rescorer {
|
||||||
rescoreContext.setParsedQuery(parsedQuery);
|
rescoreContext.setParsedQuery(parsedQuery);
|
||||||
}
|
}
|
||||||
} else if (token.isValue()) {
|
} else if (token.isValue()) {
|
||||||
if("query_weight".equals(fieldName)) {
|
if ("query_weight".equals(fieldName)) {
|
||||||
rescoreContext.setQueryWeight(parser.floatValue());
|
rescoreContext.setQueryWeight(parser.floatValue());
|
||||||
} else if("rescore_query_weight".equals(fieldName)) {
|
} else if ("rescore_query_weight".equals(fieldName)) {
|
||||||
rescoreContext.setRescoreQueryWeight(parser.floatValue());
|
rescoreContext.setRescoreQueryWeight(parser.floatValue());
|
||||||
} else if ("score_mode".equals(fieldName)) {
|
} else if ("score_mode".equals(fieldName)) {
|
||||||
String sScoreMode = parser.text();
|
String sScoreMode = parser.text();
|
||||||
|
@ -187,9 +194,9 @@ public final class QueryRescorer implements Rescorer {
|
||||||
}
|
}
|
||||||
return rescoreContext;
|
return rescoreContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class QueryRescoreContext extends RescoreSearchContext {
|
public static class QueryRescoreContext extends RescoreSearchContext {
|
||||||
|
|
||||||
public QueryRescoreContext(QueryRescorer rescorer) {
|
public QueryRescoreContext(QueryRescorer rescorer) {
|
||||||
super(NAME, 10, rescorer);
|
super(NAME, 10, rescorer);
|
||||||
this.scoreMode = ScoreMode.Total;
|
this.scoreMode = ScoreMode.Total;
|
||||||
|
@ -203,15 +210,15 @@ public final class QueryRescorer implements Rescorer {
|
||||||
public void setParsedQuery(ParsedQuery parsedQuery) {
|
public void setParsedQuery(ParsedQuery parsedQuery) {
|
||||||
this.parsedQuery = parsedQuery;
|
this.parsedQuery = parsedQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Query query() {
|
public Query query() {
|
||||||
return parsedQuery.query();
|
return parsedQuery.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float queryWeight() {
|
public float queryWeight() {
|
||||||
return queryWeight;
|
return queryWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float rescoreQueryWeight() {
|
public float rescoreQueryWeight() {
|
||||||
return rescoreQueryWeight;
|
return rescoreQueryWeight;
|
||||||
}
|
}
|
||||||
|
@ -231,10 +238,10 @@ public final class QueryRescorer implements Rescorer {
|
||||||
public void setScoreMode(ScoreMode scoreMode) {
|
public void setScoreMode(ScoreMode scoreMode) {
|
||||||
this.scoreMode = scoreMode;
|
this.scoreMode = scoreMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private TopDocs merge(TopDocs primary, TopDocs secondary, QueryRescoreContext context) {
|
private TopDocs merge(TopDocs primary, TopDocs secondary, QueryRescoreContext context) {
|
||||||
DocIdSorter sorter = new DocIdSorter();
|
DocIdSorter sorter = new DocIdSorter();
|
||||||
sorter.array = primary.scoreDocs;
|
sorter.array = primary.scoreDocs;
|
||||||
|
@ -260,10 +267,11 @@ public final class QueryRescorer implements Rescorer {
|
||||||
primary.setMaxScore(primaryDocs[0].score);
|
primary.setMaxScore(primaryDocs[0].score);
|
||||||
return primary;
|
return primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class DocIdSorter extends IntroSorter {
|
private static final class DocIdSorter extends IntroSorter {
|
||||||
private ScoreDoc[] array;
|
private ScoreDoc[] array;
|
||||||
private ScoreDoc pivot;
|
private ScoreDoc pivot;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void swap(int i, int j) {
|
protected void swap(int i, int j) {
|
||||||
ScoreDoc scoreDoc = array[i];
|
ScoreDoc scoreDoc = array[i];
|
||||||
|
@ -279,16 +287,16 @@ public final class QueryRescorer implements Rescorer {
|
||||||
@Override
|
@Override
|
||||||
protected void setPivot(int i) {
|
protected void setPivot(int i) {
|
||||||
pivot = array[i];
|
pivot = array[i];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int comparePivot(int j) {
|
protected int comparePivot(int j) {
|
||||||
return compareDocId(pivot, array[j]);
|
return compareDocId(pivot, array[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int compareDocId(ScoreDoc left, ScoreDoc right) {
|
private static final int compareDocId(ScoreDoc left, ScoreDoc right) {
|
||||||
if (left.doc < right.doc) {
|
if (left.doc < right.doc) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -297,10 +305,11 @@ public final class QueryRescorer implements Rescorer {
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class ScoreSorter extends IntroSorter {
|
private static final class ScoreSorter extends IntroSorter {
|
||||||
private ScoreDoc[] array;
|
private ScoreDoc[] array;
|
||||||
private ScoreDoc pivot;
|
private ScoreDoc pivot;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void swap(int i, int j) {
|
protected void swap(int i, int j) {
|
||||||
ScoreDoc scoreDoc = array[i];
|
ScoreDoc scoreDoc = array[i];
|
||||||
|
@ -317,7 +326,7 @@ public final class QueryRescorer implements Rescorer {
|
||||||
@Override
|
@Override
|
||||||
protected void setPivot(int i) {
|
protected void setPivot(int i) {
|
||||||
pivot = array[i];
|
pivot = array[i];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -325,12 +334,13 @@ public final class QueryRescorer implements Rescorer {
|
||||||
int cmp = Float.compare(array[j].score, pivot.score);
|
int cmp = Float.compare(array[j].score, pivot.score);
|
||||||
return cmp == 0 ? compareDocId(pivot, array[j]) : cmp;
|
return cmp == 0 ? compareDocId(pivot, array[j]) : cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class TopDocsFilter extends Filter {
|
private static final class TopDocsFilter extends Filter {
|
||||||
|
|
||||||
private final int[] docIds;
|
private final int[] docIds;
|
||||||
|
|
||||||
public TopDocsFilter(TopDocs topDocs) {
|
public TopDocsFilter(TopDocs topDocs) {
|
||||||
this.docIds = new int[topDocs.scoreDocs.length];
|
this.docIds = new int[topDocs.scoreDocs.length];
|
||||||
ScoreDoc[] scoreDocs = topDocs.scoreDocs;
|
ScoreDoc[] scoreDocs = topDocs.scoreDocs;
|
||||||
|
@ -338,51 +348,53 @@ public final class QueryRescorer implements Rescorer {
|
||||||
docIds[i] = scoreDocs[i].doc;
|
docIds[i] = scoreDocs[i].doc;
|
||||||
}
|
}
|
||||||
Arrays.sort(docIds);
|
Arrays.sort(docIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
|
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
|
||||||
final int docBase = context.docBase;
|
final int docBase = context.docBase;
|
||||||
int limit = docBase + context.reader().maxDoc();
|
int limit = docBase + context.reader().maxDoc();
|
||||||
int offset = Arrays.binarySearch(docIds, docBase);
|
int offset = Arrays.binarySearch(docIds, docBase);
|
||||||
if (offset < 0 ) {
|
if (offset < 0) {
|
||||||
offset = (-offset)-1;
|
offset = (-offset) - 1;
|
||||||
}
|
}
|
||||||
int end = Arrays.binarySearch(docIds, limit);
|
int end = Arrays.binarySearch(docIds, limit);
|
||||||
if (end < 0) {
|
if (end < 0) {
|
||||||
end = (-end)-1;
|
end = (-end) - 1;
|
||||||
}
|
}
|
||||||
final int start = offset;
|
final int start = offset;
|
||||||
final int stop = end;
|
final int stop = end;
|
||||||
|
|
||||||
return new DocIdSet() {
|
return new DocIdSet() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocIdSetIterator iterator() throws IOException {
|
public DocIdSetIterator iterator() throws IOException {
|
||||||
return new DocIdSetIterator() {
|
return new DocIdSetIterator() {
|
||||||
private int current = start;
|
private int current = start;
|
||||||
private int docId = NO_MORE_DOCS;
|
private int docId = NO_MORE_DOCS;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int nextDoc() throws IOException {
|
public int nextDoc() throws IOException {
|
||||||
if (current < stop) {
|
if (current < stop) {
|
||||||
return docId = docIds[current++]-docBase;
|
return docId = docIds[current++] - docBase;
|
||||||
}
|
}
|
||||||
return docId = NO_MORE_DOCS;
|
return docId = NO_MORE_DOCS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int docID() {
|
public int docID() {
|
||||||
return docId;
|
return docId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int advance(int target) throws IOException {
|
public int advance(int target) throws IOException {
|
||||||
if (target == NO_MORE_DOCS) {
|
if (target == NO_MORE_DOCS) {
|
||||||
current = stop;
|
current = stop;
|
||||||
return docId = NO_MORE_DOCS;
|
return docId = NO_MORE_DOCS;
|
||||||
}
|
}
|
||||||
while(nextDoc() < target) {}
|
while (nextDoc() < target) {
|
||||||
|
}
|
||||||
return docId;
|
return docId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,12 +406,12 @@ public final class QueryRescorer implements Rescorer {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void extractTerms(SearchContext context, RescoreSearchContext rescoreContext, Set<Term> termsSet) {
|
public void extractTerms(SearchContext context, RescoreSearchContext rescoreContext, Set<Term> termsSet) {
|
||||||
((QueryRescoreContext) context.rescore()).query().extractTerms(termsSet);
|
((QueryRescoreContext) context.rescore()).query().extractTerms(termsSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.search.rescore;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -17,8 +16,8 @@ package org.elasticsearch.search.rescore;
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Set;
|
package org.elasticsearch.search.rescore;
|
||||||
|
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.search.Explanation;
|
import org.apache.lucene.search.Explanation;
|
||||||
|
@ -27,8 +26,11 @@ import org.elasticsearch.action.search.SearchType;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.search.internal.SearchContext;
|
import org.elasticsearch.search.internal.SearchContext;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A query rescorer interface used to re-rank the Top-K results of a previously
|
* A query rescorer interface used to re-rank the Top-K results of a previously
|
||||||
* executed search.
|
* executed search.
|
||||||
*/
|
*/
|
||||||
public interface Rescorer {
|
public interface Rescorer {
|
||||||
|
@ -41,27 +43,29 @@ public interface Rescorer {
|
||||||
/**
|
/**
|
||||||
* Modifies the result of the previously executed search ({@link TopDocs})
|
* Modifies the result of the previously executed search ({@link TopDocs})
|
||||||
* in place based on the given {@link RescoreSearchContext}.
|
* in place based on the given {@link RescoreSearchContext}.
|
||||||
*
|
*
|
||||||
* @param topDocs the result of the previously exectued search
|
* @param topDocs the result of the previously exectued search
|
||||||
* @param context the current {@link SearchContext}. This will never be <code>null</code>.
|
* @param context the current {@link SearchContext}. This will never be <code>null</code>.
|
||||||
* @param rescoreContext the {@link RescoreSearchContext}. This will never be <code>null</code>
|
* @param rescoreContext the {@link RescoreSearchContext}. This will never be <code>null</code>
|
||||||
* @throws IOException if an {@link IOException} occurs during rescoring
|
* @throws IOException if an {@link IOException} occurs during rescoring
|
||||||
*/
|
*/
|
||||||
public void rescore(TopDocs topDocs, SearchContext context, RescoreSearchContext rescoreContext) throws IOException;
|
public void rescore(TopDocs topDocs, SearchContext context, RescoreSearchContext rescoreContext) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes an {@link Explanation} phase on the rescorer.
|
* Executes an {@link Explanation} phase on the rescorer.
|
||||||
* @param topLevelDocId the global / top-level document ID to explain
|
*
|
||||||
* @param context the current {@link SearchContext}
|
* @param topLevelDocId the global / top-level document ID to explain
|
||||||
|
* @param context the current {@link SearchContext}
|
||||||
* @param rescoreContext TODO
|
* @param rescoreContext TODO
|
||||||
* @return the explain for the given top level document ID.
|
* @return the explain for the given top level document ID.
|
||||||
* @throws IOException if an {@link IOException} occurs
|
* @throws IOException if an {@link IOException} occurs
|
||||||
*/
|
*/
|
||||||
public Explanation explain(int topLevelDocId, SearchContext context, RescoreSearchContext rescoreContext) throws IOException;
|
public Explanation explain(int topLevelDocId, SearchContext context, RescoreSearchContext rescoreContext) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the {@link RescoreSearchContext} for this impelementation
|
* Parses the {@link RescoreSearchContext} for this impelementation
|
||||||
* @param parser the parser to read the context from
|
*
|
||||||
|
* @param parser the parser to read the context from
|
||||||
* @param context the current search context
|
* @param context the current search context
|
||||||
* @return the parsed {@link RescoreSearchContext}
|
* @return the parsed {@link RescoreSearchContext}
|
||||||
* @throws IOException if an {@link IOException} occurs while parsing the context
|
* @throws IOException if an {@link IOException} occurs while parsing the context
|
||||||
|
@ -86,5 +90,5 @@ public interface Rescorer {
|
||||||
* documents are merged since in such a case we don't really have a score
|
* documents are merged since in such a case we don't really have a score
|
||||||
* per document rather a "X is more relevant than Y" relation
|
* per document rather a "X is more relevant than Y" relation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.search.scan;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -17,6 +16,9 @@ package org.elasticsearch.search.scan;
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.search.scan;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import org.apache.lucene.index.AtomicReaderContext;
|
import org.apache.lucene.index.AtomicReaderContext;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.search.suggest.completion;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -17,16 +16,19 @@ package org.elasticsearch.search.suggest.completion;
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.search.suggest.completion;
|
||||||
|
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
interface PayloadProcessor {
|
interface PayloadProcessor {
|
||||||
|
|
||||||
BytesRef buildPayload(BytesRef surfaceForm, long weight, BytesRef payload) throws IOException;
|
BytesRef buildPayload(BytesRef surfaceForm, long weight, BytesRef payload) throws IOException;
|
||||||
|
|
||||||
void parsePayload(BytesRef payload, SuggestPayload ref) throws IOException;
|
void parsePayload(BytesRef payload, SuggestPayload ref) throws IOException;
|
||||||
|
|
||||||
static class SuggestPayload {
|
static class SuggestPayload {
|
||||||
final BytesRef payload = new BytesRef();
|
final BytesRef payload = new BytesRef();
|
||||||
long weight = 0;
|
long weight = 0;
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.snapshots;
|
package org.elasticsearch.snapshots;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.snapshots;
|
package org.elasticsearch.snapshots;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchIllegalArgumentException;
|
import org.elasticsearch.ElasticsearchIllegalArgumentException;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.joda.time.base;
|
package org.joda.time.base;
|
||||||
|
|
||||||
import org.joda.time.Chronology;
|
import org.joda.time.Chronology;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.action.admin.cluster.stats;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,7 @@ package org.elasticsearch.action.admin.cluster.stats;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.action.admin.cluster.stats;
|
||||||
|
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
|
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
package org.elasticsearch.action.termvector;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -19,6 +17,8 @@ package org.elasticsearch.action.termvector;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.action.termvector;
|
||||||
|
|
||||||
import org.apache.lucene.analysis.Analyzer;
|
import org.apache.lucene.analysis.Analyzer;
|
||||||
import org.apache.lucene.analysis.TokenFilter;
|
import org.apache.lucene.analysis.TokenFilter;
|
||||||
import org.apache.lucene.analysis.Tokenizer;
|
import org.apache.lucene.analysis.Tokenizer;
|
||||||
|
@ -37,8 +37,6 @@ import org.apache.lucene.search.TopDocs;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.RAMDirectory;
|
import org.apache.lucene.store.RAMDirectory;
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.action.termvector.TermVectorRequestBuilder;
|
|
||||||
import org.elasticsearch.action.termvector.TermVectorResponse;
|
|
||||||
import org.elasticsearch.common.inject.internal.Join;
|
import org.elasticsearch.common.inject.internal.Join;
|
||||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
@ -205,11 +203,11 @@ public abstract class AbstractTermVectorTests extends ElasticsearchIntegrationTe
|
||||||
* Generate test documentsThe returned documents are already indexed.
|
* Generate test documentsThe returned documents are already indexed.
|
||||||
*/
|
*/
|
||||||
protected TestDoc[] generateTestDocs(int numberOfDocs, TestFieldSetting[] fieldSettings) {
|
protected TestDoc[] generateTestDocs(int numberOfDocs, TestFieldSetting[] fieldSettings) {
|
||||||
String[] fieldContentOptions = new String[] { "Generating a random permutation of a sequence (such as when shuffling cards).",
|
String[] fieldContentOptions = new String[]{"Generating a random permutation of a sequence (such as when shuffling cards).",
|
||||||
"Selecting a random sample of a population (important in statistical sampling).",
|
"Selecting a random sample of a population (important in statistical sampling).",
|
||||||
"Allocating experimental units via random assignment to a treatment or control condition.",
|
"Allocating experimental units via random assignment to a treatment or control condition.",
|
||||||
"Generating random numbers: see Random number generation.",
|
"Generating random numbers: see Random number generation.",
|
||||||
"Transforming a data stream (such as when using a scrambler in telecommunications)." };
|
"Transforming a data stream (such as when using a scrambler in telecommunications)."};
|
||||||
|
|
||||||
String[] contentArray = new String[fieldSettings.length];
|
String[] contentArray = new String[fieldSettings.length];
|
||||||
Map<String, Object> docSource = new HashMap<String, Object>();
|
Map<String, Object> docSource = new HashMap<String, Object>();
|
||||||
|
@ -252,21 +250,21 @@ public abstract class AbstractTermVectorTests extends ElasticsearchIntegrationTe
|
||||||
|
|
||||||
}
|
}
|
||||||
TestConfig config = new TestConfig(testDocs[randomInt(testDocs.length - 1)], selectedFields == null ? null
|
TestConfig config = new TestConfig(testDocs[randomInt(testDocs.length - 1)], selectedFields == null ? null
|
||||||
: selectedFields.toArray(new String[] {}), randomBoolean(), randomBoolean(), randomBoolean());
|
: selectedFields.toArray(new String[]{}), randomBoolean(), randomBoolean(), randomBoolean());
|
||||||
|
|
||||||
configs.add(config);
|
configs.add(config);
|
||||||
}
|
}
|
||||||
// always adds a test that fails
|
// always adds a test that fails
|
||||||
configs.add(new TestConfig(new TestDoc("doesnt_exist", new TestFieldSetting[] {}, new String[] {}).index("doesn't_exist"),
|
configs.add(new TestConfig(new TestDoc("doesnt_exist", new TestFieldSetting[]{}, new String[]{}).index("doesn't_exist"),
|
||||||
new String[] { "doesnt_exist" }, true, true, true).expectedException(IndexMissingException.class));
|
new String[]{"doesnt_exist"}, true, true, true).expectedException(IndexMissingException.class));
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
return configs.toArray(new TestConfig[] {});
|
return configs.toArray(new TestConfig[]{});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TestFieldSetting[] getFieldSettings() {
|
protected TestFieldSetting[] getFieldSettings() {
|
||||||
return new TestFieldSetting[] { new TestFieldSetting("field_with_positions", false, false, true),
|
return new TestFieldSetting[]{new TestFieldSetting("field_with_positions", false, false, true),
|
||||||
new TestFieldSetting("field_with_offsets", true, false, false),
|
new TestFieldSetting("field_with_offsets", true, false, false),
|
||||||
new TestFieldSetting("field_with_only_tv", false, false, false),
|
new TestFieldSetting("field_with_only_tv", false, false, false),
|
||||||
new TestFieldSetting("field_with_positions_offsets", false, false, true),
|
new TestFieldSetting("field_with_positions_offsets", false, false, true),
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.action.termvector;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,16 +17,14 @@ package org.elasticsearch.action.termvector;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.action.termvector;
|
||||||
|
|
||||||
import org.apache.lucene.index.DirectoryReader;
|
import org.apache.lucene.index.DirectoryReader;
|
||||||
import org.apache.lucene.index.Fields;
|
import org.apache.lucene.index.Fields;
|
||||||
import org.elasticsearch.action.termvector.MultiTermVectorsItemResponse;
|
|
||||||
import org.elasticsearch.action.termvector.MultiTermVectorsRequestBuilder;
|
|
||||||
import org.elasticsearch.action.termvector.MultiTermVectorsResponse;
|
|
||||||
import org.elasticsearch.action.termvector.TermVectorRequestBuilder;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
public class MultiTermVectorsTests extends AbstractTermVectorTests {
|
public class MultiTermVectorsTests extends AbstractTermVectorTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -64,6 +61,7 @@ public class MultiTermVectorsTests extends AbstractTermVectorTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMissingIndexThrowsMissingIndex() throws Exception {
|
public void testMissingIndexThrowsMissingIndex() throws Exception {
|
||||||
TermVectorRequestBuilder requestBuilder = client().prepareTermVector("testX", "typeX", Integer.toString(1));
|
TermVectorRequestBuilder requestBuilder = client().prepareTermVector("testX", "typeX", Integer.toString(1));
|
||||||
MultiTermVectorsRequestBuilder mtvBuilder = new MultiTermVectorsRequestBuilder(client());
|
MultiTermVectorsRequestBuilder mtvBuilder = new MultiTermVectorsRequestBuilder(client());
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.client.transport;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,7 @@ package org.elasticsearch.client.transport;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.client.transport;
|
||||||
|
|
||||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.cluster;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,7 @@ package org.elasticsearch.cluster;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.cluster;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchException;
|
import org.elasticsearch.ElasticsearchException;
|
||||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
package org.elasticsearch.cluster.allocation;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -19,6 +17,8 @@ package org.elasticsearch.cluster.allocation;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.cluster.allocation;
|
||||||
|
|
||||||
import org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator;
|
import org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator;
|
||||||
import org.elasticsearch.cluster.routing.allocation.allocator.EvenShardsCountAllocator;
|
import org.elasticsearch.cluster.routing.allocation.allocator.EvenShardsCountAllocator;
|
||||||
import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator;
|
import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.common;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,7 @@ package org.elasticsearch.common;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.common;
|
||||||
|
|
||||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.common.xcontent.support;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,7 @@ package org.elasticsearch.common.xcontent.support;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.common.xcontent.support;
|
||||||
|
|
||||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||||
|
@ -29,8 +29,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
|
|
||||||
public class XContentHelperTests extends ElasticsearchTestCase {
|
public class XContentHelperTests extends ElasticsearchTestCase {
|
||||||
|
|
||||||
Map<String, Object> getMap(Object... keyValues) {
|
Map<String, Object> getMap(Object... keyValues) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.index;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,7 @@ package org.elasticsearch.index;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.index;
|
||||||
|
|
||||||
import org.elasticsearch.common.lucene.uid.Versions;
|
import org.elasticsearch.common.lucene.uid.Versions;
|
||||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.search.source;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -18,6 +17,7 @@ package org.elasticsearch.search.source;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.search.source;
|
||||||
|
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
package org.elasticsearch.search.suggest.phrase;
|
|
||||||
/*
|
/*
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
* license agreements. See the NOTICE file distributed with
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
@ -17,6 +16,8 @@ package org.elasticsearch.search.suggest.phrase;
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
package org.elasticsearch.search.suggest.phrase;
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import org.apache.lucene.analysis.Analyzer;
|
import org.apache.lucene.analysis.Analyzer;
|
||||||
import org.apache.lucene.analysis.TokenFilter;
|
import org.apache.lucene.analysis.TokenFilter;
|
||||||
|
@ -51,6 +52,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
|
|
||||||
public class NoisyChannelSpellCheckerTests extends ElasticsearchTestCase{
|
public class NoisyChannelSpellCheckerTests extends ElasticsearchTestCase{
|
||||||
private final BytesRef space = new BytesRef(" ");
|
private final BytesRef space = new BytesRef(" ");
|
||||||
private final BytesRef preTag = new BytesRef("<em>");
|
private final BytesRef preTag = new BytesRef("<em>");
|
||||||
|
|
Loading…
Reference in New Issue