Merge pull request #13324 from rmuir/lucene_1701068

Upgrade master to lucene 5.4-snapshot r1701068
This commit is contained in:
Robert Muir 2015-09-03 15:28:52 -04:00
commit 3e9daa1040
59 changed files with 118 additions and 72 deletions

View File

@ -260,7 +260,7 @@ public class Version {
public static final int V_2_1_0_ID = 2010099;
public static final Version V_2_1_0 = new Version(V_2_1_0_ID, true, org.apache.lucene.util.Version.LUCENE_5_3_0);
public static final int V_3_0_0_ID = 3000099;
public static final Version V_3_0_0 = new Version(V_3_0_0_ID, true, org.apache.lucene.util.Version.LUCENE_5_3_0);
public static final Version V_3_0_0 = new Version(V_3_0_0_ID, true, org.apache.lucene.util.Version.LUCENE_5_4_0);
public static final Version CURRENT = V_3_0_0;
static {

View File

@ -453,8 +453,7 @@ public class AnalysisModule extends AbstractModule {
tokenFiltersBindings.processTokenFilter("apostrophe", ApostropheFilterFactory.class);
tokenFiltersBindings.processTokenFilter("classic", ClassicFilterFactory.class);
tokenFiltersBindings.processTokenFilter("decimal_digit", DecimalDigitFilterFactory.class);
}
@Override

View File

@ -0,0 +1,42 @@
/*
* 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.analysis;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.core.DecimalDigitFilter;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.Index;
/**
* Factory for {@link DecimalDigitFilter}
*/
public final class DecimalDigitFilterFactory extends AbstractTokenFilterFactory {
@Inject
public DecimalDigitFilterFactory(Index index, Settings indexSettings, String name, Settings settings) {
super(index, indexSettings, name, settings);
}
@Override
public TokenStream create(TokenStream tokenStream) {
return new DecimalDigitFilter(tokenStream);
}
}

View File

@ -254,42 +254,7 @@ public class IndexShard extends AbstractIndexShardComponent {
if (indexSettings.getAsBoolean(IndexCacheModule.QUERY_CACHE_EVERYTHING, false)) {
cachingPolicy = QueryCachingPolicy.ALWAYS_CACHE;
} else {
assert Version.CURRENT.luceneVersion == org.apache.lucene.util.Version.LUCENE_5_3_0;
// TODO: remove this hack in Lucene 5.4, use UsageTrackingQueryCachingPolicy directly
// See https://issues.apache.org/jira/browse/LUCENE-6748
// cachingPolicy = new UsageTrackingQueryCachingPolicy();
final QueryCachingPolicy wrapped = new UsageTrackingQueryCachingPolicy();
cachingPolicy = new QueryCachingPolicy() {
@Override
public boolean shouldCache(Query query, LeafReaderContext context) throws IOException {
if (query instanceof MatchAllDocsQuery
// MatchNoDocsQuery currently rewrites to a BooleanQuery,
// but who knows, it might get its own Weight one day
|| query instanceof MatchNoDocsQuery) {
return false;
}
if (query instanceof BooleanQuery) {
BooleanQuery bq = (BooleanQuery) query;
if (bq.clauses().isEmpty()) {
return false;
}
}
if (query instanceof DisjunctionMaxQuery) {
DisjunctionMaxQuery dmq = (DisjunctionMaxQuery) query;
if (dmq.getDisjuncts().isEmpty()) {
return false;
}
}
return wrapped.shouldCache(query, context);
}
@Override
public void onUse(Query query) {
wrapped.onUse(query);
}
};
cachingPolicy = new UsageTrackingQueryCachingPolicy();
}
this.engineConfig = newEngineConfig(translogConfig, cachingPolicy);
this.indexShardOperationCounter = new IndexShardOperationCounter(logger, shardId);

View File

@ -26,6 +26,7 @@ import org.apache.lucene.analysis.cjk.CJKBigramFilter;
import org.apache.lucene.analysis.cjk.CJKWidthFilter;
import org.apache.lucene.analysis.ckb.SoraniNormalizationFilter;
import org.apache.lucene.analysis.commongrams.CommonGramsFilter;
import org.apache.lucene.analysis.core.DecimalDigitFilter;
import org.apache.lucene.analysis.core.LowerCaseFilter;
import org.apache.lucene.analysis.core.Lucene43StopFilter;
import org.apache.lucene.analysis.core.StopAnalyzer;
@ -395,6 +396,13 @@ public enum PreBuiltTokenFilters {
return new CJKWidthFilter(tokenStream);
}
},
DECIMAL_DIGIT(CachingStrategy.ONE) {
@Override
public TokenStream create(TokenStream tokenStream, Version version) {
return new DecimalDigitFilter(tokenStream);
}
},
CJK_BIGRAM(CachingStrategy.ONE) {
@Override

View File

@ -87,6 +87,7 @@ public class AnalysisFactoryTests extends ESTestCase {
put("commongrams", CommonGramsTokenFilterFactory.class);
put("commongramsquery", CommonGramsTokenFilterFactory.class);
put("czechstem", CzechStemTokenFilterFactory.class);
put("decimaldigit", DecimalDigitFilterFactory.class);
put("delimitedpayload", DelimitedPayloadTokenFilterFactory.class);
put("dictionarycompoundword", DictionaryCompoundWordTokenFilterFactory.class);
put("edgengram", EdgeNGramTokenFilterFactory.class);
@ -176,6 +177,8 @@ public class AnalysisFactoryTests extends ESTestCase {
put("tokenoffsetpayload", Void.class);
// puts the type into the payload
put("typeaspayload", Void.class);
// fingerprint
put("fingerprint", Void.class);
}};
public void testTokenFilters() {

View File

@ -1 +0,0 @@
0baa82bff19059401e90e1b90020beb9c96305d7

View File

@ -1,7 +0,0 @@
Copyright (c) 2012 Terence Parr and Sam Harwell
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1 @@
29e48af049f17dd89153b83a7ad5d01b3b4bcdda

View File

@ -0,0 +1,26 @@
[The "BSD license"]
Copyright (c) 2015 Terence Parr, Sam Harwell
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1 +0,0 @@
ad568238ee36a820bd6c6806807e8a14ea34684d

View File

@ -0,0 +1 @@
0da08b8cce7bbf903602a25a3a163ae252435795

View File

@ -1 +0,0 @@
f8b86f4ee6e02082f63a658e00eb5506821253c6

View File

@ -0,0 +1 @@
5a556786086c23cd689a0328f8519db93821c04c

View File

@ -1 +0,0 @@
1502beac94cf437baff848ffbbb8f76172befa6b

View File

@ -0,0 +1 @@
35fca29c4597a15ce4d4eb7dc73a517038684a27

View File

@ -1 +0,0 @@
f654901e55fe56bdbe4be202767296929c2f8d9e

View File

@ -0,0 +1 @@
e4769b5c05fad8339f4eaf9cfa9e850cbeaa10ec

View File

@ -1 +0,0 @@
9e12bb7c39e964a544e3a23b9c8ffa9599d38f10

View File

@ -0,0 +1 @@
3bbab9d7a395bd0b6cc8b5bee26287105c8659e8

View File

@ -1 +0,0 @@
dc6f5e352f787d71a7896025c0cdd0eb665b2985

View File

@ -0,0 +1 @@
d60476428e7d3d8a68fe491d42dbda0d4024f589

View File

@ -1 +0,0 @@
2d27582889b8676dfed6880a920148f3e32c9b42

View File

@ -0,0 +1 @@
8618da3f400f0a4b140f196bbbecb0686fe754db

View File

@ -1 +0,0 @@
3b9d67c0f93e107a9ad8c179505df56a85e3f027

View File

@ -0,0 +1 @@
c7db4fe5587d08ab23b253c622566462aab6796a

View File

@ -1 +0,0 @@
95ddffcd889af106136704ecb7dc7173b3e9cdb3

View File

@ -0,0 +1 @@
f9c8d435d3e1d553b0dca05c99b1fa377568eed0

View File

@ -1 +0,0 @@
44f50f425264b4b17e6781ba07bdc80b4d36bb65

View File

@ -0,0 +1 @@
571dd2e4363f0a0410de04b3f3f4bbf66e782c31

View File

@ -1 +0,0 @@
d03ce6d1bb8ab3926b3acc717418c474a49ade69

View File

@ -0,0 +1 @@
423264f839aace3b9159a0dd54f56c250458fd46

View File

@ -1 +0,0 @@
a0e8ff0bb90fd762800afdd434fdf769b1f9ac28

View File

@ -0,0 +1 @@
872530eeac156faa0989eb87145bbef74a72e66f

View File

@ -1 +0,0 @@
2c5e08580316c90b56a52e3cb686e1cf69db3f9e

View File

@ -0,0 +1 @@
6f6b6a024ca96017252efea6d2fc7dc97c69febd

View File

@ -1 +0,0 @@
152da54a3b1ea6e3e8648d767616a51857b66a8e

View File

@ -0,0 +1 @@
a6f5a5c84b165ebde104cdcde46fa9c5948650f0

View File

@ -1 +0,0 @@
6d57880a0950416035112f4fcc725854c011b081

View File

@ -0,0 +1 @@
a305601f93b6cb02444816c96276a74f91ac7d40

View File

@ -1 +0,0 @@
23cfd7c19ead7b6fc6b2921f9c490ad3d043770d

View File

@ -0,0 +1 @@
ef1fcaa5b6663dd9382719a1ad40d86fc962c690

View File

@ -1 +0,0 @@
a155fc16a20b11205f99603950025522b173edc9

View File

@ -0,0 +1 @@
3698e0623f45e181d2ceead46e48a6dd8c2867dd

View File

@ -84,3 +84,5 @@ include::tokenfilters/keep-types-tokenfilter.asciidoc[]
include::tokenfilters/classic-tokenfilter.asciidoc[]
include::tokenfilters/apostrophe-tokenfilter.asciidoc[]
include::tokenfilters/decimal-digit-tokenfilter.asciidoc[]

View File

@ -0,0 +1,4 @@
[[analysis-decimal-digit-tokenfilter]]
=== Decimal Digit Token Filter
The `decimal_digit` token filter folds unicode digits to `0-9`

View File

@ -1 +0,0 @@
e6dd489db555ad84279732c5f189406d20b63c84

View File

@ -0,0 +1 @@
b7f57ef60f302b30e88196d4f0d11f789c5cfabd

View File

@ -1 +0,0 @@
b3e67473646e3869fcdeb4a3151ab597b957fbf2

View File

@ -0,0 +1 @@
5d1023fc3f28a42357d44d3a330ac0df1df4bf42

View File

@ -1 +0,0 @@
471f3ee15053413e75c5c24a978494a6d4984240

View File

@ -0,0 +1 @@
654c3e345ffdd74605582d1320c51c1c550a5cca

View File

@ -1 +0,0 @@
e37000b73d34ba33dda26f46893b09ba275c5294

View File

@ -0,0 +1 @@
80c09e367abf2ad936c86cf74a16ae2b4e805b81

View File

@ -1 +0,0 @@
fcc4bf8ccbda52435d13525d7cfc66cecf5c5125

View File

@ -0,0 +1 @@
7c6ae4fc7e8e1d39c155068fea67b7fabb12c444

View File

@ -41,8 +41,9 @@
<maven.compiler.target>1.8</maven.compiler.target>
<!-- libraries -->
<lucene.version>5.3.0</lucene.version>
<lucene.maven.version>5.3.0</lucene.maven.version>
<lucene.version>5.4.0</lucene.version>
<lucene.snapshot.revision>1701068</lucene.snapshot.revision>
<lucene.maven.version>5.4.0-snapshot-${lucene.snapshot.revision}</lucene.maven.version>
<testframework.version>2.1.16</testframework.version>
<jackson.version>2.5.3</jackson.version>
<slf4j.version>1.6.2</slf4j.version>
@ -137,6 +138,10 @@
<name>Sonatype OSS Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>Lucene snapshots</id>
<url>https://download.elasticsearch.org/lucenesnapshots/${lucene.snapshot.revision}</url>
</repository>
</repositories>
<dependencyManagement>