diff --git a/src/main/java/org/apache/lucene/index/memory/ExtendedMemoryIndex.java b/src/main/java/org/apache/lucene/index/memory/ExtendedMemoryIndex.java index 985a7fe0327..5f99fcefa94 100644 --- a/src/main/java/org/apache/lucene/index/memory/ExtendedMemoryIndex.java +++ b/src/main/java/org/apache/lucene/index/memory/ExtendedMemoryIndex.java @@ -1,5 +1,3 @@ -package org.apache.lucene.index.memory; - /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -19,6 +17,8 @@ package org.apache.lucene.index.memory; * under the License. */ +package org.apache.lucene.index.memory; + /** * This class overwrites {@link MemoryIndex} to make the reuse constructor visible. */ diff --git a/src/main/java/org/apache/lucene/queries/ExtendedCommonTermsQuery.java b/src/main/java/org/apache/lucene/queries/ExtendedCommonTermsQuery.java index fcabe471f0e..b9627891019 100644 --- a/src/main/java/org/apache/lucene/queries/ExtendedCommonTermsQuery.java +++ b/src/main/java/org/apache/lucene/queries/ExtendedCommonTermsQuery.java @@ -1,4 +1,3 @@ -package org.apache.lucene.queries; /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -17,11 +16,14 @@ package org.apache.lucene.queries; * specific language governing permissions and limitations * under the License. */ + +package org.apache.lucene.queries; + import org.apache.lucene.search.BooleanClause.Occur; 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 * minimumNumberShouldMatch specification that uses the actual num of high frequent terms * to calculate the minimum matching terms. */ @@ -34,7 +36,7 @@ public class ExtendedCommonTermsQuery extends CommonTermsQuery { public ExtendedCommonTermsQuery(Occur highFreqOccur, Occur lowFreqOccur, float maxTermFrequency) { super(highFreqOccur, lowFreqOccur, maxTermFrequency); } - + private String lowFreqMinNumShouldMatchSpec; private String highFreqMinNumShouldMatchSpec; @@ -54,7 +56,7 @@ public class ExtendedCommonTermsQuery extends CommonTermsQuery { protected int calcHighFreqMinimumNumberShouldMatch(int numOptional) { return calcMinimumNumberShouldMatch(highFreqMinNumShouldMatchSpec, numOptional); } - + public void setHighFreqMinimumNumberShouldMatch(String spec) { this.highFreqMinNumShouldMatchSpec = spec; } diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIndices.java b/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIndices.java index 6ba1e49d9f8..44a7bbc3e69 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIndices.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIndices.java @@ -1,4 +1,3 @@ -package org.elasticsearch.action.admin.cluster.stats; /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -18,6 +17,7 @@ package org.elasticsearch.action.admin.cluster.stats; * under the License. */ +package org.elasticsearch.action.admin.cluster.stats; import com.carrotsearch.hppc.ObjectObjectOpenHashMap; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; @@ -249,17 +249,23 @@ public class ClusterStatsIndices implements ToXContent, Streamable { 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() { 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() { return this.minIndexShards; } - /** average number of shards (primary+replicas) across the indices */ + /** + * average number of shards (primary+replicas) across the indices + */ public double getAvgIndexShards() { if (this.indices == 0) { return -1; @@ -274,12 +280,16 @@ public class ClusterStatsIndices implements ToXContent, Streamable { return this.maxIndexPrimaryShards; } - /** the minimum number of primary shards an index has */ + /** + * the minimum number of primary shards an index has + */ public int getMinIndexPrimaryShards() { return this.minIndexPrimaryShards; } - /** the average number primary shards across the indices */ + /** + * the average number primary shards across the indices + */ public double getAvgIndexPrimaryShards() { if (this.indices == 0) { return -1; diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java b/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java index 3458ae84b79..9c5f4247487 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java @@ -1,4 +1,3 @@ -package org.elasticsearch.action.admin.cluster.stats; /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -18,6 +17,7 @@ package org.elasticsearch.action.admin.cluster.stats; * under the License. */ +package org.elasticsearch.action.admin.cluster.stats; import com.carrotsearch.hppc.ObjectIntOpenHashMap; import com.carrotsearch.hppc.cursors.ObjectIntCursor; diff --git a/src/main/java/org/elasticsearch/action/termvector/MultiTermVectorsRequest.java b/src/main/java/org/elasticsearch/action/termvector/MultiTermVectorsRequest.java index 578860b2f15..95453de6d07 100644 --- a/src/main/java/org/elasticsearch/action/termvector/MultiTermVectorsRequest.java +++ b/src/main/java/org/elasticsearch/action/termvector/MultiTermVectorsRequest.java @@ -1,5 +1,3 @@ -package org.elasticsearch.action.termvector; - /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -19,6 +17,8 @@ package org.elasticsearch.action.termvector; * under the License. */ +package org.elasticsearch.action.termvector; + import org.elasticsearch.ElasticsearchIllegalArgumentException; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.action.ActionRequest; diff --git a/src/main/java/org/elasticsearch/action/termvector/MultiTermVectorsRequestBuilder.java b/src/main/java/org/elasticsearch/action/termvector/MultiTermVectorsRequestBuilder.java index 3782cf50b54..877283c8159 100644 --- a/src/main/java/org/elasticsearch/action/termvector/MultiTermVectorsRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/termvector/MultiTermVectorsRequestBuilder.java @@ -1,4 +1,3 @@ -package org.elasticsearch.action.termvector; /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -18,6 +17,7 @@ package org.elasticsearch.action.termvector; * under the License. */ +package org.elasticsearch.action.termvector; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequestBuilder; diff --git a/src/main/java/org/elasticsearch/action/update/UpdateHelper.java b/src/main/java/org/elasticsearch/action/update/UpdateHelper.java index c5f1ad85a28..5d7dcac45bf 100644 --- a/src/main/java/org/elasticsearch/action/update/UpdateHelper.java +++ b/src/main/java/org/elasticsearch/action/update/UpdateHelper.java @@ -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; import org.elasticsearch.ElasticsearchIllegalArgumentException; diff --git a/src/main/java/org/elasticsearch/common/collect/HppcMaps.java b/src/main/java/org/elasticsearch/common/collect/HppcMaps.java index b59e45da4d7..be6f1da5b94 100644 --- a/src/main/java/org/elasticsearch/common/collect/HppcMaps.java +++ b/src/main/java/org/elasticsearch/common/collect/HppcMaps.java @@ -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; import com.carrotsearch.hppc.ObjectIntOpenHashMap; diff --git a/src/main/java/org/elasticsearch/common/joda/DateMathParser.java b/src/main/java/org/elasticsearch/common/joda/DateMathParser.java index 365eba448eb..12d0d4236bb 100644 --- a/src/main/java/org/elasticsearch/common/joda/DateMathParser.java +++ b/src/main/java/org/elasticsearch/common/joda/DateMathParser.java @@ -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; import org.elasticsearch.ElasticsearchParseException; diff --git a/src/main/java/org/elasticsearch/index/analysis/CJKBigramFilterFactory.java b/src/main/java/org/elasticsearch/index/analysis/CJKBigramFilterFactory.java index 58040466235..444f0072c0d 100644 --- a/src/main/java/org/elasticsearch/index/analysis/CJKBigramFilterFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/CJKBigramFilterFactory.java @@ -1,4 +1,3 @@ -package org.elasticsearch.index.analysis; /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -17,9 +16,8 @@ package org.elasticsearch.index.analysis; * specific language governing permissions and limitations * under the License. */ -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; + +package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.TokenStream; 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.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 * that are generated from StandardTokenizer or ICUTokenizer. - *
+ *
* 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. - *+ *
* 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 * bigrams, set theoutputUnigrams
flag. This can be used for a
* combined unigram+bigram approach.
- * + *
* In all cases, all non-CJK input is passed thru unmodified. */ public final class CJKBigramFilterFactory extends AbstractTokenFilterFactory { @@ -63,11 +65,11 @@ public final class CJKBigramFilterFactory extends AbstractTokenFilterFactory { flags |= CJKBigramFilter.HAN; } else if ("hiragana".equals(script)) { flags |= CJKBigramFilter.HIRAGANA; - } else if("katakana".equals(script)) { + } else if ("katakana".equals(script)) { flags |= CJKBigramFilter.KATAKANA; - } else if("hangul".equals(script)) { + } else if ("hangul".equals(script)) { flags |= CJKBigramFilter.HANGUL; - } + } } this.flags = flags; } diff --git a/src/main/java/org/elasticsearch/index/analysis/CJKWidthFilterFactory.java b/src/main/java/org/elasticsearch/index/analysis/CJKWidthFilterFactory.java index c03234b1376..d1aa0c25fa3 100644 --- a/src/main/java/org/elasticsearch/index/analysis/CJKWidthFilterFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/CJKWidthFilterFactory.java @@ -1,4 +1,3 @@ -package org.elasticsearch.index.analysis; /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -17,6 +16,9 @@ package org.elasticsearch.index.analysis; * specific language governing permissions and limitations * under the License. */ + +package org.elasticsearch.index.analysis; + import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.cjk.CJKWidthFilter; import org.elasticsearch.common.inject.Inject; diff --git a/src/main/java/org/elasticsearch/index/analysis/KeepWordFilterFactory.java b/src/main/java/org/elasticsearch/index/analysis/KeepWordFilterFactory.java index abe15dcfe00..1178aedb81c 100644 --- a/src/main/java/org/elasticsearch/index/analysis/KeepWordFilterFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/KeepWordFilterFactory.java @@ -1,4 +1,3 @@ -package org.elasticsearch.index.analysis; /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -18,6 +17,8 @@ package org.elasticsearch.index.analysis; * under the License. */ +package org.elasticsearch.index.analysis; + import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.miscellaneous.KeepWordFilter; import org.apache.lucene.analysis.util.CharArraySet; diff --git a/src/main/java/org/elasticsearch/index/fielddata/AbstractIndexFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/AbstractIndexFieldData.java index 554d0789747..34e1ef80a29 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/AbstractIndexFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/AbstractIndexFieldData.java @@ -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; import org.apache.lucene.index.AtomicReaderContext; diff --git a/src/main/java/org/elasticsearch/index/fielddata/fieldcomparator/DoubleValuesComparatorBase.java b/src/main/java/org/elasticsearch/index/fielddata/fieldcomparator/DoubleValuesComparatorBase.java index 9461cab20bf..47bfa1d98e3 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/fieldcomparator/DoubleValuesComparatorBase.java +++ b/src/main/java/org/elasticsearch/index/fielddata/fieldcomparator/DoubleValuesComparatorBase.java @@ -1,4 +1,3 @@ -package org.elasticsearch.index.fielddata.fieldcomparator; /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -18,6 +17,8 @@ package org.elasticsearch.index.fielddata.fieldcomparator; * under the License. */ +package org.elasticsearch.index.fielddata.fieldcomparator; + import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.search.FieldComparator; import org.elasticsearch.index.fielddata.DoubleValues; diff --git a/src/main/java/org/elasticsearch/index/fielddata/fieldcomparator/LongValuesComparatorBase.java b/src/main/java/org/elasticsearch/index/fielddata/fieldcomparator/LongValuesComparatorBase.java index 167795b6bac..a6ebd35923b 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/fieldcomparator/LongValuesComparatorBase.java +++ b/src/main/java/org/elasticsearch/index/fielddata/fieldcomparator/LongValuesComparatorBase.java @@ -1,4 +1,3 @@ -package org.elasticsearch.index.fielddata.fieldcomparator; /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -18,6 +17,8 @@ package org.elasticsearch.index.fielddata.fieldcomparator; * under the License. */ +package org.elasticsearch.index.fielddata.fieldcomparator; + import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.search.FieldComparator; import org.elasticsearch.index.fielddata.IndexNumericFieldData; diff --git a/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java b/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java index 1b8368e045f..a7b88051a9a 100644 --- a/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java +++ b/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java @@ -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; import org.apache.lucene.index.Term; diff --git a/src/main/java/org/elasticsearch/index/query/SimpleQueryStringFlag.java b/src/main/java/org/elasticsearch/index/query/SimpleQueryStringFlag.java index 4db5fe74d68..8e492a460fc 100644 --- a/src/main/java/org/elasticsearch/index/query/SimpleQueryStringFlag.java +++ b/src/main/java/org/elasticsearch/index/query/SimpleQueryStringFlag.java @@ -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; import org.apache.lucene.queryparser.XSimpleQueryParser; diff --git a/src/main/java/org/elasticsearch/percolator/PercolateException.java b/src/main/java/org/elasticsearch/percolator/PercolateException.java index bf3358bcb3c..c5b7fa7d677 100644 --- a/src/main/java/org/elasticsearch/percolator/PercolateException.java +++ b/src/main/java/org/elasticsearch/percolator/PercolateException.java @@ -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; import org.elasticsearch.ElasticsearchException; diff --git a/src/main/java/org/elasticsearch/search/rescore/QueryRescorer.java b/src/main/java/org/elasticsearch/search/rescore/QueryRescorer.java index 22703d84679..b8e26a86dd5 100644 --- a/src/main/java/org/elasticsearch/search/rescore/QueryRescorer.java +++ b/src/main/java/org/elasticsearch/search/rescore/QueryRescorer.java @@ -1,4 +1,3 @@ -package org.elasticsearch.search.rescore; /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with @@ -17,6 +16,9 @@ package org.elasticsearch.search.rescore; * specific language governing permissions and limitations * under the License. */ + +package org.elasticsearch.search.rescore; + import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.Term; import org.apache.lucene.search.*; @@ -41,6 +43,7 @@ public final class QueryRescorer implements Rescorer { public float combine(float primary, float secondary) { return (primary + secondary) / 2; } + @Override public String toString() { return "avg"; @@ -51,6 +54,7 @@ public final class QueryRescorer implements Rescorer { public float combine(float primary, float secondary) { return Math.max(primary, secondary); } + @Override public String toString() { return "max"; @@ -61,6 +65,7 @@ public final class QueryRescorer implements Rescorer { public float combine(float primary, float secondary) { return Math.min(primary, secondary); } + @Override public String toString() { return "min"; @@ -71,6 +76,7 @@ public final class QueryRescorer implements Rescorer { public float combine(float primary, float secondary) { return primary + secondary; } + @Override public String toString() { return "sum"; @@ -81,6 +87,7 @@ public final class QueryRescorer implements Rescorer { public float combine(float primary, float secondary) { return primary * secondary; } + @Override public String toString() { return "product"; @@ -99,7 +106,7 @@ public final class QueryRescorer implements Rescorer { } @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; QueryRescoreContext rescore = ((QueryRescoreContext) rescoreContext); TopDocs queryTopDocs = context.queryResult().topDocs(); @@ -119,7 +126,7 @@ public final class QueryRescorer implements Rescorer { Explanation primaryExplain = searcher.explain(context.query(), topLevelDocId); if (primaryExplain == null) { // 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); float primaryWeight = rescore.queryWeight(); @@ -161,9 +168,9 @@ public final class QueryRescorer implements Rescorer { rescoreContext.setParsedQuery(parsedQuery); } } else if (token.isValue()) { - if("query_weight".equals(fieldName)) { + if ("query_weight".equals(fieldName)) { rescoreContext.setQueryWeight(parser.floatValue()); - } else if("rescore_query_weight".equals(fieldName)) { + } else if ("rescore_query_weight".equals(fieldName)) { rescoreContext.setRescoreQueryWeight(parser.floatValue()); } else if ("score_mode".equals(fieldName)) { String sScoreMode = parser.text(); @@ -187,9 +194,9 @@ public final class QueryRescorer implements Rescorer { } return rescoreContext; } - + public static class QueryRescoreContext extends RescoreSearchContext { - + public QueryRescoreContext(QueryRescorer rescorer) { super(NAME, 10, rescorer); this.scoreMode = ScoreMode.Total; @@ -203,15 +210,15 @@ public final class QueryRescorer implements Rescorer { public void setParsedQuery(ParsedQuery parsedQuery) { this.parsedQuery = parsedQuery; } - + public Query query() { return parsedQuery.query(); } - + public float queryWeight() { return queryWeight; } - + public float rescoreQueryWeight() { return rescoreQueryWeight; } @@ -231,10 +238,10 @@ public final class QueryRescorer implements Rescorer { public void setScoreMode(ScoreMode scoreMode) { this.scoreMode = scoreMode; } - + } - - + + private TopDocs merge(TopDocs primary, TopDocs secondary, QueryRescoreContext context) { DocIdSorter sorter = new DocIdSorter(); sorter.array = primary.scoreDocs; @@ -260,10 +267,11 @@ public final class QueryRescorer implements Rescorer { primary.setMaxScore(primaryDocs[0].score); return primary; } - + private static final class DocIdSorter extends IntroSorter { private ScoreDoc[] array; private ScoreDoc pivot; + @Override protected void swap(int i, int j) { ScoreDoc scoreDoc = array[i]; @@ -279,16 +287,16 @@ public final class QueryRescorer implements Rescorer { @Override protected void setPivot(int i) { pivot = array[i]; - + } @Override protected int comparePivot(int j) { return compareDocId(pivot, array[j]); } - + } - + private static final int compareDocId(ScoreDoc left, ScoreDoc right) { if (left.doc < right.doc) { return 1; @@ -297,10 +305,11 @@ public final class QueryRescorer implements Rescorer { } return -1; } - + private static final class ScoreSorter extends IntroSorter { private ScoreDoc[] array; private ScoreDoc pivot; + @Override protected void swap(int i, int j) { ScoreDoc scoreDoc = array[i]; @@ -317,7 +326,7 @@ public final class QueryRescorer implements Rescorer { @Override protected void setPivot(int i) { pivot = array[i]; - + } @Override @@ -325,12 +334,13 @@ public final class QueryRescorer implements Rescorer { int cmp = Float.compare(array[j].score, pivot.score); return cmp == 0 ? compareDocId(pivot, array[j]) : cmp; } - + } - + private static final class TopDocsFilter extends Filter { private final int[] docIds; + public TopDocsFilter(TopDocs topDocs) { this.docIds = new int[topDocs.scoreDocs.length]; ScoreDoc[] scoreDocs = topDocs.scoreDocs; @@ -338,51 +348,53 @@ public final class QueryRescorer implements Rescorer { docIds[i] = scoreDocs[i].doc; } Arrays.sort(docIds); - + } + @Override public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException { final int docBase = context.docBase; - int limit = docBase + context.reader().maxDoc(); + int limit = docBase + context.reader().maxDoc(); int offset = Arrays.binarySearch(docIds, docBase); - if (offset < 0 ) { - offset = (-offset)-1; + if (offset < 0) { + offset = (-offset) - 1; } int end = Arrays.binarySearch(docIds, limit); if (end < 0) { - end = (-end)-1; - } + end = (-end) - 1; + } final int start = offset; final int stop = end; - + return new DocIdSet() { - + @Override public DocIdSetIterator iterator() throws IOException { return new DocIdSetIterator() { private int current = start; private int docId = NO_MORE_DOCS; - + @Override public int nextDoc() throws IOException { if (current < stop) { - return docId = docIds[current++]-docBase; + return docId = docIds[current++] - docBase; } return docId = NO_MORE_DOCS; } - + @Override public int docID() { return docId; } - + @Override public int advance(int target) throws IOException { if (target == NO_MORE_DOCS) { current = stop; return docId = NO_MORE_DOCS; } - while(nextDoc() < target) {} + while (nextDoc() < target) { + } return docId; } @@ -394,12 +406,12 @@ public final class QueryRescorer implements Rescorer { } }; } - + } @Override public void extractTerms(SearchContext context, RescoreSearchContext rescoreContext, Setnull
.
+ *
+ * @param topDocs the result of the previously exectued search
+ * @param context the current {@link SearchContext}. This will never be null
.
* @param rescoreContext the {@link RescoreSearchContext}. This will never be null
* @throws IOException if an {@link IOException} occurs during rescoring
*/
public void rescore(TopDocs topDocs, SearchContext context, RescoreSearchContext rescoreContext) throws IOException;
-
+
/**
- * Executes an {@link Explanation} phase on the rescorer.
- * @param topLevelDocId the global / top-level document ID to explain
- * @param context the current {@link SearchContext}
+ * 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 rescoreContext TODO
* @return the explain for the given top level document ID.
* @throws IOException if an {@link IOException} occurs
*/
public Explanation explain(int topLevelDocId, SearchContext context, RescoreSearchContext rescoreContext) throws IOException;
-
+
/**
* 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
* @return the parsed {@link RescoreSearchContext}
* @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
* per document rather a "X is more relevant than Y" relation
*/
-
+
}
diff --git a/src/main/java/org/elasticsearch/search/scan/ScanContext.java b/src/main/java/org/elasticsearch/search/scan/ScanContext.java
index 6c1b3372d00..76d30ae5ffc 100644
--- a/src/main/java/org/elasticsearch/search/scan/ScanContext.java
+++ b/src/main/java/org/elasticsearch/search/scan/ScanContext.java
@@ -1,4 +1,3 @@
-package org.elasticsearch.search.scan;
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
@@ -17,6 +16,9 @@ package org.elasticsearch.search.scan;
* specific language governing permissions and limitations
* under the License.
*/
+
+package org.elasticsearch.search.scan;
+
import com.google.common.collect.Maps;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
diff --git a/src/main/java/org/elasticsearch/search/suggest/completion/PayloadProcessor.java b/src/main/java/org/elasticsearch/search/suggest/completion/PayloadProcessor.java
index 5eeb75f9482..4ee79b67fe7 100644
--- a/src/main/java/org/elasticsearch/search/suggest/completion/PayloadProcessor.java
+++ b/src/main/java/org/elasticsearch/search/suggest/completion/PayloadProcessor.java
@@ -1,4 +1,3 @@
-package org.elasticsearch.search.suggest.completion;
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
@@ -17,16 +16,19 @@ package org.elasticsearch.search.suggest.completion;
* specific language governing permissions and limitations
* under the License.
*/
+
+package org.elasticsearch.search.suggest.completion;
+
import org.apache.lucene.util.BytesRef;
import java.io.IOException;
interface PayloadProcessor {
-
+
BytesRef buildPayload(BytesRef surfaceForm, long weight, BytesRef payload) throws IOException;
void parsePayload(BytesRef payload, SuggestPayload ref) throws IOException;
-
+
static class SuggestPayload {
final BytesRef payload = new BytesRef();
long weight = 0;
diff --git a/src/main/java/org/elasticsearch/snapshots/SnapshotShardFailure.java b/src/main/java/org/elasticsearch/snapshots/SnapshotShardFailure.java
index 88db3ad0637..83c903244a8 100644
--- a/src/main/java/org/elasticsearch/snapshots/SnapshotShardFailure.java
+++ b/src/main/java/org/elasticsearch/snapshots/SnapshotShardFailure.java
@@ -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;
import org.elasticsearch.ElasticsearchParseException;
diff --git a/src/main/java/org/elasticsearch/snapshots/SnapshotState.java b/src/main/java/org/elasticsearch/snapshots/SnapshotState.java
index f2c9922e6cb..88a2a98650f 100644
--- a/src/main/java/org/elasticsearch/snapshots/SnapshotState.java
+++ b/src/main/java/org/elasticsearch/snapshots/SnapshotState.java
@@ -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;
import org.elasticsearch.ElasticsearchIllegalArgumentException;
diff --git a/src/main/java/org/joda/time/base/BaseDateTime.java b/src/main/java/org/joda/time/base/BaseDateTime.java
index b49fd3b52a0..c1f54273704 100644
--- a/src/main/java/org/joda/time/base/BaseDateTime.java
+++ b/src/main/java/org/joda/time/base/BaseDateTime.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.joda.time.base;
import org.joda.time.Chronology;
diff --git a/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java b/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java
index 8dd68d51cde..23ccae70fe3 100644
--- a/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java
+++ b/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java
@@ -1,4 +1,3 @@
-package org.elasticsearch.action.admin.cluster.stats;
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
@@ -18,6 +17,7 @@ package org.elasticsearch.action.admin.cluster.stats;
* under the License.
*/
+package org.elasticsearch.action.admin.cluster.stats;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
diff --git a/src/test/java/org/elasticsearch/action/termvector/AbstractTermVectorTests.java b/src/test/java/org/elasticsearch/action/termvector/AbstractTermVectorTests.java
index dcde4def330..09646c62f0b 100644
--- a/src/test/java/org/elasticsearch/action/termvector/AbstractTermVectorTests.java
+++ b/src/test/java/org/elasticsearch/action/termvector/AbstractTermVectorTests.java
@@ -1,5 +1,3 @@
-package org.elasticsearch.action.termvector;
-
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
@@ -19,6 +17,8 @@ package org.elasticsearch.action.termvector;
* under the License.
*/
+package org.elasticsearch.action.termvector;
+
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenFilter;
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.RAMDirectory;
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.settings.ImmutableSettings;
import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -205,11 +203,11 @@ public abstract class AbstractTermVectorTests extends ElasticsearchIntegrationTe
* Generate test documentsThe returned documents are already indexed.
*/
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).",
"Allocating experimental units via random assignment to a treatment or control condition.",
"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];
Map