Merge branch 'master' into enhancement/replicate_primary_write_failures
This commit is contained in:
commit
603d5063a0
|
@ -94,4 +94,9 @@ public interface XContentGenerator extends Closeable, Flushable {
|
|||
|
||||
void copyCurrentStructure(XContentParser parser) throws IOException;
|
||||
|
||||
/**
|
||||
* Returns {@code true} if this XContentGenerator has been closed. A closed generator can not do any more output.
|
||||
*/
|
||||
boolean isClosed();
|
||||
|
||||
}
|
||||
|
|
|
@ -419,4 +419,8 @@ public class JsonXContentGenerator implements XContentGenerator {
|
|||
generator.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClosed() {
|
||||
return generator.isClosed();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ import org.elasticsearch.index.query.QueryShardContext;
|
|||
import org.elasticsearch.index.shard.IndexEventListener;
|
||||
import org.elasticsearch.index.shard.IndexSearcherWrapper;
|
||||
import org.elasticsearch.index.shard.IndexShard;
|
||||
import org.elasticsearch.index.shard.IndexShardClosedException;
|
||||
import org.elasticsearch.index.shard.IndexingOperationListener;
|
||||
import org.elasticsearch.index.shard.SearchOperationListener;
|
||||
import org.elasticsearch.index.shard.ShadowIndexShard;
|
||||
|
@ -692,7 +693,7 @@ public class IndexService extends AbstractIndexComponent implements IndicesClust
|
|||
if (shard.isRefreshNeeded()) {
|
||||
shard.refresh("schedule");
|
||||
}
|
||||
} catch (EngineClosedException | AlreadyClosedException ex) {
|
||||
} catch (IndexShardClosedException | AlreadyClosedException ex) {
|
||||
// fine - continue;
|
||||
}
|
||||
continue;
|
||||
|
|
|
@ -34,11 +34,22 @@ public abstract class RestBuilderListener<Response> extends RestResponseListener
|
|||
|
||||
@Override
|
||||
public final RestResponse buildResponse(Response response) throws Exception {
|
||||
return buildResponse(response, channel.newBuilder());
|
||||
try (XContentBuilder builder = channel.newBuilder()) {
|
||||
final RestResponse restResponse = buildResponse(response, builder);
|
||||
assert assertBuilderClosed(builder);
|
||||
return restResponse;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a response to send back over the channel.
|
||||
* Builds a response to send back over the channel. Implementors should ensure that they close the provided {@link XContentBuilder}
|
||||
* using the {@link XContentBuilder#close()} method.
|
||||
*/
|
||||
public abstract RestResponse buildResponse(Response response, XContentBuilder builder) throws Exception;
|
||||
|
||||
// pkg private method that we can override for testing
|
||||
boolean assertBuilderClosed(XContentBuilder xContentBuilder) {
|
||||
assert xContentBuilder.generator().isClosed() : "callers should ensure the XContentBuilder is closed themselves";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ public final class Script implements ToXContent, Writeable {
|
|||
boolean hasType = type != null;
|
||||
out.writeBoolean(hasType);
|
||||
if (hasType) {
|
||||
ScriptType.writeTo(type, out);
|
||||
type.writeTo(out);
|
||||
}
|
||||
out.writeOptionalString(lang);
|
||||
out.writeMap(params);
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ScriptModes {
|
|||
}
|
||||
|
||||
static String sourceKey(ScriptType scriptType) {
|
||||
return SCRIPT_SETTINGS_PREFIX + "." + scriptType.getScriptType();
|
||||
return SCRIPT_SETTINGS_PREFIX + "." + scriptType.getName();
|
||||
}
|
||||
|
||||
static String getGlobalKey(String lang, ScriptType scriptType) {
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ScriptSettings {
|
|||
for (ScriptType scriptType : ScriptType.values()) {
|
||||
scriptTypeSettingMap.put(scriptType, Setting.boolSetting(
|
||||
ScriptModes.sourceKey(scriptType),
|
||||
scriptType.getDefaultScriptEnabled(),
|
||||
scriptType.isDefaultEnabled(),
|
||||
Property.NodeScope));
|
||||
}
|
||||
SCRIPT_TYPE_SETTING_MAP = Collections.unmodifiableMap(scriptTypeSettingMap);
|
||||
|
@ -102,7 +102,7 @@ public class ScriptSettings {
|
|||
boolean defaultLangAndType = defaultNonFileScriptMode;
|
||||
// Files are treated differently because they are never default-deny
|
||||
if (ScriptType.FILE == scriptType) {
|
||||
defaultLangAndType = ScriptType.FILE.getDefaultScriptEnabled();
|
||||
defaultLangAndType = ScriptType.FILE.isDefaultEnabled();
|
||||
}
|
||||
final boolean defaultIfNothingSet = defaultLangAndType;
|
||||
|
||||
|
|
|
@ -22,68 +22,118 @@ package org.elasticsearch.script;
|
|||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* The type of a script, more specifically where it gets loaded from:
|
||||
* - provided dynamically at request time
|
||||
* - loaded from an index
|
||||
* - loaded from file
|
||||
* ScriptType represents the way a script is stored and retrieved from the {@link ScriptService}.
|
||||
* It's also used to by {@link ScriptSettings} and {@link ScriptModes} to determine whether or not
|
||||
* a {@link Script} is allowed to be executed based on both default and user-defined settings.
|
||||
*/
|
||||
public enum ScriptType {
|
||||
public enum ScriptType implements Writeable {
|
||||
|
||||
INLINE(0, "inline", "inline", false),
|
||||
STORED(1, "id", "stored", false),
|
||||
FILE(2, "file", "file", true);
|
||||
/**
|
||||
* INLINE scripts are specified in numerous queries and compiled on-the-fly.
|
||||
* They will be cached based on the lang and code of the script.
|
||||
* They are turned off by default because most languages are insecure
|
||||
* (Groovy and others), but can be overriden by the specific {@link ScriptEngineService}
|
||||
* if the language is naturally secure (Painless, Mustache, and Expressions).
|
||||
*/
|
||||
INLINE ( 0 , new ParseField("inline") , false ),
|
||||
|
||||
private final int val;
|
||||
private final ParseField parseField;
|
||||
private final String scriptType;
|
||||
private final boolean defaultScriptEnabled;
|
||||
/**
|
||||
* STORED scripts are saved as part of the {@link org.elasticsearch.cluster.ClusterState}
|
||||
* based on user requests. They will be cached when they are first used in a query.
|
||||
* They are turned off by default because most languages are insecure
|
||||
* (Groovy and others), but can be overriden by the specific {@link ScriptEngineService}
|
||||
* if the language is naturally secure (Painless, Mustache, and Expressions).
|
||||
*/
|
||||
STORED ( 1 , new ParseField("stored", "id") , false ),
|
||||
|
||||
/**
|
||||
* FILE scripts are loaded from disk either on start-up or on-the-fly depending on
|
||||
* user-defined settings. They will be compiled and cached as soon as they are loaded
|
||||
* from disk. They are turned on by default as they should always be safe to execute.
|
||||
*/
|
||||
FILE ( 2 , new ParseField("file") , true );
|
||||
|
||||
/**
|
||||
* Reads an int from the input stream and converts it to a {@link ScriptType}.
|
||||
* @return The ScriptType read from the stream. Throws an {@link IllegalStateException}
|
||||
* if no ScriptType is found based on the id.
|
||||
*/
|
||||
public static ScriptType readFrom(StreamInput in) throws IOException {
|
||||
int scriptTypeVal = in.readVInt();
|
||||
for (ScriptType type : values()) {
|
||||
if (type.val == scriptTypeVal) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value read for ScriptType got [" + scriptTypeVal + "] expected one of ["
|
||||
+ INLINE.val + "," + FILE.val + "," + STORED.val + "]");
|
||||
}
|
||||
int id = in.readVInt();
|
||||
|
||||
public static void writeTo(ScriptType scriptType, StreamOutput out) throws IOException{
|
||||
if (scriptType != null) {
|
||||
out.writeVInt(scriptType.val);
|
||||
if (FILE.id == id) {
|
||||
return FILE;
|
||||
} else if (STORED.id == id) {
|
||||
return STORED;
|
||||
} else if (INLINE.id == id) {
|
||||
return INLINE;
|
||||
} else {
|
||||
out.writeVInt(INLINE.val); //Default to inline
|
||||
throw new IllegalStateException("Error reading ScriptType id [" + id + "] from stream, expected one of [" +
|
||||
FILE.id + " [" + FILE.parseField.getPreferredName() + "], " +
|
||||
STORED.id + " [" + STORED.parseField.getPreferredName() + "], " +
|
||||
INLINE.id + " [" + INLINE.parseField.getPreferredName() + "]]");
|
||||
}
|
||||
}
|
||||
|
||||
ScriptType(int val, String name, String scriptType, boolean defaultScriptEnabled) {
|
||||
this.val = val;
|
||||
this.parseField = new ParseField(name);
|
||||
this.scriptType = scriptType;
|
||||
this.defaultScriptEnabled = defaultScriptEnabled;
|
||||
private final int id;
|
||||
private final ParseField parseField;
|
||||
private final boolean defaultEnabled;
|
||||
|
||||
/**
|
||||
* Standard constructor.
|
||||
* @param id A unique identifier for a type that can be read/written to a stream.
|
||||
* @param parseField Specifies the name used to parse input from queries.
|
||||
* @param defaultEnabled Whether or not a {@link ScriptType} can be run by default.
|
||||
*/
|
||||
ScriptType(int id, ParseField parseField, boolean defaultEnabled) {
|
||||
this.id = id;
|
||||
this.parseField = parseField;
|
||||
this.defaultEnabled = defaultEnabled;
|
||||
}
|
||||
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeVInt(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The unique id for this {@link ScriptType}.
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The unique name for this {@link ScriptType} based on the {@link ParseField}.
|
||||
*/
|
||||
public String getName() {
|
||||
return parseField.getPreferredName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Specifies the name used to parse input from queries.
|
||||
*/
|
||||
public ParseField getParseField() {
|
||||
return parseField;
|
||||
}
|
||||
|
||||
public boolean getDefaultScriptEnabled() {
|
||||
return defaultScriptEnabled;
|
||||
}
|
||||
|
||||
public String getScriptType() {
|
||||
return scriptType;
|
||||
/**
|
||||
* @return Whether or not a {@link ScriptType} can be run by default. Note
|
||||
* this can be potentially overriden by any {@link ScriptEngineService}.
|
||||
*/
|
||||
public boolean isDefaultEnabled() {
|
||||
return defaultEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The same as calling {@link #getName()}.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
return getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,13 +50,13 @@ import org.elasticsearch.common.collect.Tuple;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.discovery.zen.ElectMasterService;
|
||||
import org.elasticsearch.discovery.zen.ZenDiscovery;
|
||||
import org.elasticsearch.discovery.zen.FaultDetection;
|
||||
import org.elasticsearch.discovery.zen.MembershipAction;
|
||||
import org.elasticsearch.discovery.zen.PublishClusterStateAction;
|
||||
import org.elasticsearch.discovery.zen.UnicastZenPing;
|
||||
import org.elasticsearch.discovery.zen.ZenDiscovery;
|
||||
import org.elasticsearch.discovery.zen.ZenPing;
|
||||
import org.elasticsearch.discovery.zen.ZenPingService;
|
||||
import org.elasticsearch.discovery.zen.UnicastZenPing;
|
||||
import org.elasticsearch.discovery.zen.PublishClusterStateAction;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.indices.store.IndicesStoreIntegrationIT;
|
||||
import org.elasticsearch.monitor.jvm.HotThreads;
|
||||
|
@ -155,6 +155,12 @@ public class DiscoveryWithServiceDisruptionsIT extends ESIntegTestCase {
|
|||
|
||||
private boolean disableBeforeIndexDeletion;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
disableBeforeIndexDeletion = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisruptionScheme(ServiceDisruptionScheme scheme) {
|
||||
if (scheme instanceof NetworkDisruption &&
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* 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.rest.action;
|
||||
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BytesRestResponse;
|
||||
import org.elasticsearch.rest.RestResponse;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.test.rest.FakeRestChannel;
|
||||
import org.elasticsearch.test.rest.FakeRestRequest;
|
||||
import org.elasticsearch.transport.TransportResponse;
|
||||
import org.elasticsearch.transport.TransportResponse.Empty;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class RestBuilderListenerTests extends ESTestCase {
|
||||
|
||||
public void testXContentBuilderClosedInBuildResponse() throws Exception {
|
||||
AtomicReference<XContentBuilder> builderAtomicReference = new AtomicReference<>();
|
||||
RestBuilderListener<TransportResponse.Empty> builderListener =
|
||||
new RestBuilderListener<Empty>(new FakeRestChannel(new FakeRestRequest(), randomBoolean(), 1)) {
|
||||
@Override
|
||||
public RestResponse buildResponse(Empty empty, XContentBuilder builder) throws Exception {
|
||||
builderAtomicReference.set(builder);
|
||||
builder.close();
|
||||
return new BytesRestResponse(RestStatus.OK, BytesRestResponse.TEXT_CONTENT_TYPE, BytesArray.EMPTY);
|
||||
}
|
||||
};
|
||||
|
||||
builderListener.buildResponse(Empty.INSTANCE);
|
||||
assertNotNull(builderAtomicReference.get());
|
||||
assertTrue(builderAtomicReference.get().generator().isClosed());
|
||||
}
|
||||
|
||||
public void testXContentBuilderNotClosedInBuildResponseAssertionsDisabled() throws Exception {
|
||||
AtomicReference<XContentBuilder> builderAtomicReference = new AtomicReference<>();
|
||||
RestBuilderListener<TransportResponse.Empty> builderListener =
|
||||
new RestBuilderListener<Empty>(new FakeRestChannel(new FakeRestRequest(), randomBoolean(), 1)) {
|
||||
@Override
|
||||
public RestResponse buildResponse(Empty empty, XContentBuilder builder) throws Exception {
|
||||
builderAtomicReference.set(builder);
|
||||
return new BytesRestResponse(RestStatus.OK, BytesRestResponse.TEXT_CONTENT_TYPE, BytesArray.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean assertBuilderClosed(XContentBuilder xContentBuilder) {
|
||||
// don't check the actual builder being closed so we can test auto close
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
builderListener.buildResponse(Empty.INSTANCE);
|
||||
assertNotNull(builderAtomicReference.get());
|
||||
assertTrue(builderAtomicReference.get().generator().isClosed());
|
||||
}
|
||||
|
||||
public void testXContentBuilderNotClosedInBuildResponseAssertionsEnabled() throws Exception {
|
||||
assumeTrue("tests are not being run with assertions", RestBuilderListener.class.desiredAssertionStatus());
|
||||
|
||||
RestBuilderListener<TransportResponse.Empty> builderListener =
|
||||
new RestBuilderListener<Empty>(new FakeRestChannel(new FakeRestRequest(), randomBoolean(), 1)) {
|
||||
@Override
|
||||
public RestResponse buildResponse(Empty empty, XContentBuilder builder) throws Exception {
|
||||
return new BytesRestResponse(RestStatus.OK, BytesRestResponse.TEXT_CONTENT_TYPE, BytesArray.EMPTY);
|
||||
}
|
||||
};
|
||||
|
||||
AssertionError error = expectThrows(AssertionError.class, () -> builderListener.buildResponse(Empty.INSTANCE));
|
||||
assertEquals("callers should ensure the XContentBuilder is closed themselves", error.getMessage());
|
||||
}
|
||||
}
|
|
@ -62,7 +62,7 @@ public class NativeScriptTests extends ESTestCase {
|
|||
Settings.Builder builder = Settings.builder();
|
||||
if (randomBoolean()) {
|
||||
ScriptType scriptType = randomFrom(ScriptType.values());
|
||||
builder.put("script" + "." + scriptType.getScriptType(), randomBoolean());
|
||||
builder.put("script" + "." + scriptType.getName(), randomBoolean());
|
||||
} else {
|
||||
ScriptContext scriptContext = randomFrom(ScriptContext.Standard.values());
|
||||
builder.put("script" + "." + scriptContext.getKey(), randomBoolean());
|
||||
|
|
|
@ -125,7 +125,7 @@ public class ScriptModesTests extends ESTestCase {
|
|||
ScriptType[] randomScriptTypes = randomScriptTypesSet.toArray(new ScriptType[randomScriptTypesSet.size()]);
|
||||
Settings.Builder builder = Settings.builder();
|
||||
for (int i = 0; i < randomInt; i++) {
|
||||
builder.put("script" + "." + randomScriptTypes[i].getScriptType(), randomScriptModes[i]);
|
||||
builder.put("script" + "." + randomScriptTypes[i].getName(), randomScriptModes[i]);
|
||||
}
|
||||
this.scriptModes = new ScriptModes(scriptSettings, builder.build());
|
||||
|
||||
|
|
|
@ -266,9 +266,9 @@ public class ScriptServiceTests extends ESTestCase {
|
|||
Settings.Builder builder = Settings.builder();
|
||||
for (Map.Entry<ScriptType, Boolean> entry : scriptSourceSettings.entrySet()) {
|
||||
if (entry.getValue()) {
|
||||
builder.put("script" + "." + entry.getKey().getScriptType(), "true");
|
||||
builder.put("script" + "." + entry.getKey().getName(), "true");
|
||||
} else {
|
||||
builder.put("script" + "." + entry.getKey().getScriptType(), "false");
|
||||
builder.put("script" + "." + entry.getKey().getName(), "false");
|
||||
}
|
||||
}
|
||||
for (Map.Entry<ScriptContext, Boolean> entry : scriptContextSettings.entrySet()) {
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
[[analysis-ukrainian]]
|
||||
=== Ukrainian Analysis Plugin
|
||||
|
||||
The Ukrainian Analysis plugin integrates Lucene's UkrainianMorfologikAnalyzer into elasticsearch.
|
||||
|
||||
It provides stemming for Ukrainian using the http://github.com/morfologik/morfologik-stemming[Morfologik project].
|
||||
|
||||
[[analysis-ukrainian-install]]
|
||||
[float]
|
||||
==== Installation
|
||||
|
||||
This plugin can be installed using the plugin manager:
|
||||
|
||||
[source,sh]
|
||||
----------------------------------------------------------------
|
||||
sudo bin/elasticsearch-plugin install analysis-ukrainian
|
||||
----------------------------------------------------------------
|
||||
|
||||
The plugin must be installed on every node in the cluster, and each node must
|
||||
be restarted after installation.
|
||||
|
||||
This plugin can be downloaded for <<plugin-management-custom-url,offline install>> from
|
||||
{plugin_url}/analysis-ukrainian/analysis-ukrainian-{version}.zip.
|
||||
|
||||
[[analysis-ukrainian-remove]]
|
||||
[float]
|
||||
==== Removal
|
||||
|
||||
The plugin can be removed with the following command:
|
||||
|
||||
[source,sh]
|
||||
----------------------------------------------------------------
|
||||
sudo bin/elasticsearch-plugin remove analysis-ukrainian
|
||||
----------------------------------------------------------------
|
||||
|
||||
The node must be stopped before removing the plugin.
|
||||
|
||||
[[analysis-ukrainian-analyzer]]
|
||||
[float]
|
||||
==== `ukrainian` analyzer
|
||||
|
||||
The plugin provides the `ukrainian` analyzer.
|
|
@ -36,6 +36,10 @@ segmented into words.
|
|||
|
||||
Provides high quality stemming for Polish.
|
||||
|
||||
<<analysis-ukrainian,Ukrainian>>::
|
||||
|
||||
Provides stemming for Ukrainian.
|
||||
|
||||
[float]
|
||||
==== Community contributed analysis plugins
|
||||
|
||||
|
@ -62,5 +66,6 @@ include::analysis-smartcn.asciidoc[]
|
|||
|
||||
include::analysis-stempel.asciidoc[]
|
||||
|
||||
include::analysis-ukrainian.asciidoc[]
|
||||
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ GET test/_search
|
|||
"function_score": {
|
||||
"script_score": {
|
||||
"script": {
|
||||
"id": "my_script", <2>
|
||||
"stored": "my_script", <2>
|
||||
"lang": "javascript",
|
||||
"params": {
|
||||
"factor": 2
|
||||
|
|
|
@ -119,7 +119,7 @@ GET test/_search
|
|||
"function_score": {
|
||||
"script_score": {
|
||||
"script": {
|
||||
"id": "my_script", <2>
|
||||
"stored": "my_script", <2>
|
||||
"lang": "python",
|
||||
"params": {
|
||||
"factor": 2
|
||||
|
|
|
@ -19,6 +19,7 @@ U7321H6 analysis-kuromoji {version} The Japanese (kuromoji) Analysis plugi
|
|||
U7321H6 analysis-phonetic {version} The Phonetic Analysis plugin integrates phonetic token filter analysis with elasticsearch.
|
||||
U7321H6 analysis-smartcn {version} Smart Chinese Analysis plugin integrates Lucene Smart Chinese analysis module into elasticsearch.
|
||||
U7321H6 analysis-stempel {version} The Stempel (Polish) Analysis plugin integrates Lucene stempel (polish) analysis module into elasticsearch.
|
||||
U7321H6 analysis-ukrainian {version} The Ukrainian Analysis plugin integrates the Lucene UkrainianMorfologikAnalyzer into elasticsearch.
|
||||
U7321H6 discovery-azure-classic {version} The Azure Classic Discovery plugin allows to use Azure Classic API for the unicast discovery mechanism
|
||||
U7321H6 discovery-ec2 {version} The EC2 discovery plugin allows to use AWS API for the unicast discovery mechanism.
|
||||
U7321H6 discovery-file {version} Discovery file plugin enables unicast discovery from hosts stored in a file.
|
||||
|
|
|
@ -6,7 +6,7 @@ codes, zip codes or tags.
|
|||
|
||||
They are typically used for filtering (_Find me all blog posts where
|
||||
++status++ is ++published++_), for sorting, and for aggregations. Keyword
|
||||
fields are ony searchable by their exact value.
|
||||
fields are only searchable by their exact value.
|
||||
|
||||
If you need to index full text content such as email bodies or product
|
||||
descriptions, it is likely that you should rather use a <<text,`text`>> field.
|
||||
|
|
|
@ -8,12 +8,12 @@ the same pattern:
|
|||
-------------------------------------
|
||||
"script": {
|
||||
"lang": "...", <1>
|
||||
"inline" | "id" | "file": "...", <2>
|
||||
"inline" | "stored" | "file": "...", <2>
|
||||
"params": { ... } <3>
|
||||
}
|
||||
-------------------------------------
|
||||
<1> The language the script is written in, which defaults to `painless`.
|
||||
<2> The script itself which may be specified as `inline`, `id`, or `file`.
|
||||
<2> The script itself which may be specified as `inline`, `stored`, or `file`.
|
||||
<3> Any named parameters that should be passed into the script.
|
||||
|
||||
For example, the following script is used in a search request to return a
|
||||
|
@ -211,7 +211,7 @@ GET _scripts/groovy/calculate-score
|
|||
// CONSOLE
|
||||
// TEST[continued]
|
||||
|
||||
Stored scripts can be used by specifying the `lang` and `id` parameters as follows:
|
||||
Stored scripts can be used by specifying the `lang` and `stored` parameters as follows:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
|
@ -221,7 +221,7 @@ GET _search
|
|||
"script": {
|
||||
"script": {
|
||||
"lang": "groovy",
|
||||
"id": "calculate-score",
|
||||
"stored": "calculate-score",
|
||||
"params": {
|
||||
"my_modifier": 2
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ GET /_search
|
|||
{
|
||||
"query": {
|
||||
"template": {
|
||||
"id": "my_template", <1>
|
||||
"stored": "my_template", <1>
|
||||
"params" : {
|
||||
"query_string" : "all about search"
|
||||
}
|
||||
|
|
|
@ -23,14 +23,19 @@ documented individually.
|
|||
[float]
|
||||
=== Development vs. production mode
|
||||
|
||||
By default, Elasticsearch binds and publishes to `localhost`. This is
|
||||
By default, Elasticsearch binds to `localhost` for <<modules-http,HTTP>>
|
||||
and <<modules-transport,transport (internal)>> communication. This is
|
||||
fine for downloading and playing with Elasticsearch, and everyday
|
||||
development but it's useless for production systems. For a production
|
||||
installation to be reachable, it must either bind or publish to an
|
||||
external interface. Thus, we consider Elasticsearch to be in development
|
||||
mode if it does not bind nor publish to an external interface (the
|
||||
default), and is otherwise in production mode if it does bind or publish
|
||||
to an external interface.
|
||||
development but it's useless for production systems. To form a cluster,
|
||||
Elasticsearch instances must be reachable via transport communication so
|
||||
they must bind transport to an external interface. Thus, we consider an
|
||||
Elaticsearch instance to be in development mode if it does not bind
|
||||
transport to an external interface (the default), and is otherwise in
|
||||
production mode if it does bind transport to an external interface. Note
|
||||
that HTTP can be configured independently of transport via
|
||||
<<modules-http,`http.host`>> and <<modules-transport,`transport.host`>>;
|
||||
this can be useful for configuring a single instance to be reachable via
|
||||
HTTP for testing purposes without triggering production mode.
|
||||
|
||||
=== Heap size check
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ public class SearchTemplateRequest extends ActionRequest<SearchTemplateRequest>
|
|||
out.writeBoolean(simulate);
|
||||
out.writeBoolean(explain);
|
||||
out.writeBoolean(profile);
|
||||
ScriptType.writeTo(scriptType, out);
|
||||
scriptType.writeTo(out);
|
||||
out.writeOptionalString(script);
|
||||
boolean hasParams = scriptParams != null;
|
||||
out.writeBoolean(hasParams);
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
warnings:
|
||||
- '[template] query is deprecated, use search template api instead'
|
||||
search:
|
||||
body: { "query": { "template": { "id": "1", "params": { "my_value": "value1" } } } }
|
||||
body: { "query": { "template": { "stored": "1", "params": { "my_value": "value1" } } } }
|
||||
|
||||
- match: { hits.total: 1 }
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
|||
warnings:
|
||||
- '[template] query is deprecated, use search template api instead'
|
||||
search:
|
||||
body: { "query": { "template": { "id": "/mustache/1", "params": { "my_value": "value1" } } } }
|
||||
body: { "query": { "template": { "stored": "/mustache/1", "params": { "my_value": "value1" } } } }
|
||||
|
||||
- match: { hits.total: 1 }
|
||||
|
||||
|
|
|
@ -99,7 +99,6 @@ public class Netty3Utils {
|
|||
InternalLoggerFactory.setDefaultFactory(new InternalLoggerFactory() {
|
||||
@Override
|
||||
public InternalLogger newInstance(String name) {
|
||||
name = name.replace("org.jboss.netty.", "netty3.").replace("org.jboss.netty.", "netty3.");
|
||||
return new Netty3InternalESLogger(Loggers.getLogger(name));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -41,7 +41,7 @@ public class Netty4Utils {
|
|||
|
||||
@Override
|
||||
public InternalLogger newInstance(final String name) {
|
||||
return new Netty4InternalESLogger(name.replace("io.netty.", "netty."));
|
||||
return new Netty4InternalESLogger(name);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
esplugin {
|
||||
description 'The Ukrainian Analysis plugin integrates the Lucene UkrainianMorfologikAnalyzer into elasticsearch.'
|
||||
classname 'org.elasticsearch.plugin.analysis.ukrainian.AnalysisUkrainianPlugin'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.apache.lucene:lucene-analyzers-morfologik:${versions.lucene}"
|
||||
compile "org.carrot2:morfologik-stemming:2.1.0"
|
||||
compile "org.carrot2:morfologik-fsa:2.1.0"
|
||||
}
|
||||
|
||||
dependencyLicenses {
|
||||
mapping from: /lucene-.*/, to: 'lucene'
|
||||
mapping from: /morfologik-.*/, to: 'lucene'
|
||||
}
|
||||
|
||||
thirdPartyAudit.excludes = [
|
||||
// we don't use the morfologik-fsa polish stemmer
|
||||
'morfologik.stemming.polish.PolishStemmer'
|
||||
]
|
|
@ -0,0 +1,475 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed 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.
|
||||
|
||||
|
||||
|
||||
Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
|
||||
derived from unicode conversion examples available at
|
||||
http://www.unicode.org/Public/PROGRAMS/CVTUTF. Here is the copyright
|
||||
from those sources:
|
||||
|
||||
/*
|
||||
* Copyright 2001-2004 Unicode, Inc.
|
||||
*
|
||||
* Disclaimer
|
||||
*
|
||||
* This source code is provided as is by Unicode, Inc. No claims are
|
||||
* made as to fitness for any particular purpose. No warranties of any
|
||||
* kind are expressed or implied. The recipient agrees to determine
|
||||
* applicability of information provided. If this file has been
|
||||
* purchased on magnetic or optical media from Unicode, Inc., the
|
||||
* sole remedy for any claim will be exchange of defective media
|
||||
* within 90 days of receipt.
|
||||
*
|
||||
* Limitations on Rights to Redistribute This Code
|
||||
*
|
||||
* Unicode, Inc. hereby grants the right to freely use the information
|
||||
* supplied in this file in the creation of products supporting the
|
||||
* Unicode Standard, and to make copies of this file in any form
|
||||
* for internal or external distribution as long as this notice
|
||||
* remains attached.
|
||||
*/
|
||||
|
||||
|
||||
Some code in core/src/java/org/apache/lucene/util/ArrayUtil.java was
|
||||
derived from Python 2.4.2 sources available at
|
||||
http://www.python.org. Full license is here:
|
||||
|
||||
http://www.python.org/download/releases/2.4.2/license/
|
||||
|
||||
Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
|
||||
derived from Python 3.1.2 sources available at
|
||||
http://www.python.org. Full license is here:
|
||||
|
||||
http://www.python.org/download/releases/3.1.2/license/
|
||||
|
||||
Some code in core/src/java/org/apache/lucene/util/automaton was
|
||||
derived from Brics automaton sources available at
|
||||
www.brics.dk/automaton/. Here is the copyright from those sources:
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2009 Anders Moeller
|
||||
* 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.
|
||||
*/
|
||||
|
||||
The levenshtein automata tables in core/src/java/org/apache/lucene/util/automaton
|
||||
were automatically generated with the moman/finenight FSA package.
|
||||
Here is the copyright for those sources:
|
||||
|
||||
# Copyright (c) 2010, Jean-Philippe Barrette-LaPierre, <jpb@rrette.com>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation
|
||||
# files (the "Software"), to deal in the Software without
|
||||
# restriction, including without limitation the rights to use,
|
||||
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following
|
||||
# conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
|
||||
derived from ICU (http://www.icu-project.org)
|
||||
The full license is available here:
|
||||
http://source.icu-project.org/repos/icu/icu/trunk/license.html
|
||||
|
||||
/*
|
||||
* Copyright (C) 1999-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, and/or sell copies of the
|
||||
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* provided that the above copyright notice(s) and this permission notice appear
|
||||
* in all copies of the Software and that both the above copyright notice(s) and
|
||||
* this permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
|
||||
* LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of a copyright holder shall not
|
||||
* be used in advertising or otherwise to promote the sale, use or other
|
||||
* dealings in this Software without prior written authorization of the
|
||||
* copyright holder.
|
||||
*/
|
||||
|
||||
The following license applies to the Snowball stemmers:
|
||||
|
||||
Copyright (c) 2001, Dr Martin Porter
|
||||
Copyright (c) 2002, Richard Boulton
|
||||
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 copyright holders 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.
|
||||
|
||||
The following license applies to the KStemmer:
|
||||
|
||||
Copyright © 2003,
|
||||
Center for Intelligent Information Retrieval,
|
||||
University of Massachusetts, Amherst.
|
||||
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 names "Center for Intelligent Information Retrieval" and
|
||||
"University of Massachusetts" must not be used to endorse or promote products
|
||||
derived from this software without prior written permission. To obtain
|
||||
permission, contact info@ciir.cs.umass.edu.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF MASSACHUSETTS AND OTHER 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 HOLDERS 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.
|
||||
|
||||
The following license applies to the Morfologik project:
|
||||
|
||||
Copyright (c) 2006 Dawid Weiss
|
||||
Copyright (c) 2007-2011 Dawid Weiss, Marcin Miłkowski
|
||||
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 Morfologik 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 HOLDER 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.
|
||||
|
||||
---
|
||||
|
||||
The dictionary comes from Morfologik project. Morfologik uses data from
|
||||
Polish ispell/myspell dictionary hosted at http://www.sjp.pl/slownik/en/ and
|
||||
is licenced on the terms of (inter alia) LGPL and Creative Commons
|
||||
ShareAlike. The part-of-speech tags were added in Morfologik project and
|
||||
are not found in the data from sjp.pl. The tagset is similar to IPI PAN
|
||||
tagset.
|
||||
|
||||
---
|
||||
|
||||
The following license applies to the Morfeusz project,
|
||||
used by org.apache.lucene.analysis.morfologik.
|
||||
|
||||
BSD-licensed dictionary of Polish (SGJP)
|
||||
http://sgjp.pl/morfeusz/
|
||||
|
||||
Copyright © 2011 Zygmunt Saloni, Włodzimierz Gruszczyński,
|
||||
Marcin Woliński, Robert Wołosz
|
||||
|
||||
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.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS “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 COPYRIGHT HOLDERS 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.
|
|
@ -0,0 +1,191 @@
|
|||
Apache Lucene
|
||||
Copyright 2014 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
Includes software from other Apache Software Foundation projects,
|
||||
including, but not limited to:
|
||||
- Apache Ant
|
||||
- Apache Jakarta Regexp
|
||||
- Apache Commons
|
||||
- Apache Xerces
|
||||
|
||||
ICU4J, (under analysis/icu) is licensed under an MIT styles license
|
||||
and Copyright (c) 1995-2008 International Business Machines Corporation and others
|
||||
|
||||
Some data files (under analysis/icu/src/data) are derived from Unicode data such
|
||||
as the Unicode Character Database. See http://unicode.org/copyright.html for more
|
||||
details.
|
||||
|
||||
Brics Automaton (under core/src/java/org/apache/lucene/util/automaton) is
|
||||
BSD-licensed, created by Anders Møller. See http://www.brics.dk/automaton/
|
||||
|
||||
The levenshtein automata tables (under core/src/java/org/apache/lucene/util/automaton) were
|
||||
automatically generated with the moman/finenight FSA library, created by
|
||||
Jean-Philippe Barrette-LaPierre. This library is available under an MIT license,
|
||||
see http://sites.google.com/site/rrettesite/moman and
|
||||
http://bitbucket.org/jpbarrette/moman/overview/
|
||||
|
||||
The class org.apache.lucene.util.WeakIdentityMap was derived from
|
||||
the Apache CXF project and is Apache License 2.0.
|
||||
|
||||
The Google Code Prettify is Apache License 2.0.
|
||||
See http://code.google.com/p/google-code-prettify/
|
||||
|
||||
JUnit (junit-4.10) is licensed under the Common Public License v. 1.0
|
||||
See http://junit.sourceforge.net/cpl-v10.html
|
||||
|
||||
This product includes code (JaspellTernarySearchTrie) from Java Spelling Checkin
|
||||
g Package (jaspell): http://jaspell.sourceforge.net/
|
||||
License: The BSD License (http://www.opensource.org/licenses/bsd-license.php)
|
||||
|
||||
The snowball stemmers in
|
||||
analysis/common/src/java/net/sf/snowball
|
||||
were developed by Martin Porter and Richard Boulton.
|
||||
The snowball stopword lists in
|
||||
analysis/common/src/resources/org/apache/lucene/analysis/snowball
|
||||
were developed by Martin Porter and Richard Boulton.
|
||||
The full snowball package is available from
|
||||
http://snowball.tartarus.org/
|
||||
|
||||
The KStem stemmer in
|
||||
analysis/common/src/org/apache/lucene/analysis/en
|
||||
was developed by Bob Krovetz and Sergio Guzman-Lara (CIIR-UMass Amherst)
|
||||
under the BSD-license.
|
||||
|
||||
The Arabic,Persian,Romanian,Bulgarian, and Hindi analyzers (common) come with a default
|
||||
stopword list that is BSD-licensed created by Jacques Savoy. These files reside in:
|
||||
analysis/common/src/resources/org/apache/lucene/analysis/ar/stopwords.txt,
|
||||
analysis/common/src/resources/org/apache/lucene/analysis/fa/stopwords.txt,
|
||||
analysis/common/src/resources/org/apache/lucene/analysis/ro/stopwords.txt,
|
||||
analysis/common/src/resources/org/apache/lucene/analysis/bg/stopwords.txt,
|
||||
analysis/common/src/resources/org/apache/lucene/analysis/hi/stopwords.txt
|
||||
See http://members.unine.ch/jacques.savoy/clef/index.html.
|
||||
|
||||
The German,Spanish,Finnish,French,Hungarian,Italian,Portuguese,Russian and Swedish light stemmers
|
||||
(common) are based on BSD-licensed reference implementations created by Jacques Savoy and
|
||||
Ljiljana Dolamic. These files reside in:
|
||||
analysis/common/src/java/org/apache/lucene/analysis/de/GermanLightStemmer.java
|
||||
analysis/common/src/java/org/apache/lucene/analysis/de/GermanMinimalStemmer.java
|
||||
analysis/common/src/java/org/apache/lucene/analysis/es/SpanishLightStemmer.java
|
||||
analysis/common/src/java/org/apache/lucene/analysis/fi/FinnishLightStemmer.java
|
||||
analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchLightStemmer.java
|
||||
analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchMinimalStemmer.java
|
||||
analysis/common/src/java/org/apache/lucene/analysis/hu/HungarianLightStemmer.java
|
||||
analysis/common/src/java/org/apache/lucene/analysis/it/ItalianLightStemmer.java
|
||||
analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseLightStemmer.java
|
||||
analysis/common/src/java/org/apache/lucene/analysis/ru/RussianLightStemmer.java
|
||||
analysis/common/src/java/org/apache/lucene/analysis/sv/SwedishLightStemmer.java
|
||||
|
||||
The Stempel analyzer (stempel) includes BSD-licensed software developed
|
||||
by the Egothor project http://egothor.sf.net/, created by Leo Galambos, Martin Kvapil,
|
||||
and Edmond Nolan.
|
||||
|
||||
The Polish analyzer (stempel) comes with a default
|
||||
stopword list that is BSD-licensed created by the Carrot2 project. The file resides
|
||||
in stempel/src/resources/org/apache/lucene/analysis/pl/stopwords.txt.
|
||||
See http://project.carrot2.org/license.html.
|
||||
|
||||
The SmartChineseAnalyzer source code (smartcn) was
|
||||
provided by Xiaoping Gao and copyright 2009 by www.imdict.net.
|
||||
|
||||
WordBreakTestUnicode_*.java (under modules/analysis/common/src/test/)
|
||||
is derived from Unicode data such as the Unicode Character Database.
|
||||
See http://unicode.org/copyright.html for more details.
|
||||
|
||||
The Morfologik analyzer (morfologik) includes BSD-licensed software
|
||||
developed by Dawid Weiss and Marcin Miłkowski (http://morfologik.blogspot.com/).
|
||||
|
||||
Morfologik uses data from Polish ispell/myspell dictionary
|
||||
(http://www.sjp.pl/slownik/en/) licenced on the terms of (inter alia)
|
||||
LGPL and Creative Commons ShareAlike.
|
||||
|
||||
Morfologic includes data from BSD-licensed dictionary of Polish (SGJP)
|
||||
(http://sgjp.pl/morfeusz/)
|
||||
|
||||
Servlet-api.jar and javax.servlet-*.jar are under the CDDL license, the original
|
||||
source code for this can be found at http://www.eclipse.org/jetty/downloads.php
|
||||
|
||||
===========================================================================
|
||||
Kuromoji Japanese Morphological Analyzer - Apache Lucene Integration
|
||||
===========================================================================
|
||||
|
||||
This software includes a binary and/or source version of data from
|
||||
|
||||
mecab-ipadic-2.7.0-20070801
|
||||
|
||||
which can be obtained from
|
||||
|
||||
http://atilika.com/releases/mecab-ipadic/mecab-ipadic-2.7.0-20070801.tar.gz
|
||||
|
||||
or
|
||||
|
||||
http://jaist.dl.sourceforge.net/project/mecab/mecab-ipadic/2.7.0-20070801/mecab-ipadic-2.7.0-20070801.tar.gz
|
||||
|
||||
===========================================================================
|
||||
mecab-ipadic-2.7.0-20070801 Notice
|
||||
===========================================================================
|
||||
|
||||
Nara Institute of Science and Technology (NAIST),
|
||||
the copyright holders, disclaims all warranties with regard to this
|
||||
software, including all implied warranties of merchantability and
|
||||
fitness, in no event shall NAIST be liable for
|
||||
any special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether in an
|
||||
action of contract, negligence or other tortuous action, arising out
|
||||
of or in connection with the use or performance of this software.
|
||||
|
||||
A large portion of the dictionary entries
|
||||
originate from ICOT Free Software. The following conditions for ICOT
|
||||
Free Software applies to the current dictionary as well.
|
||||
|
||||
Each User may also freely distribute the Program, whether in its
|
||||
original form or modified, to any third party or parties, PROVIDED
|
||||
that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
|
||||
on, or be attached to, the Program, which is distributed substantially
|
||||
in the same form as set out herein and that such intended
|
||||
distribution, if actually made, will neither violate or otherwise
|
||||
contravene any of the laws and regulations of the countries having
|
||||
jurisdiction over the User or the intended distribution itself.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
The program was produced on an experimental basis in the course of the
|
||||
research and development conducted during the project and is provided
|
||||
to users as so produced on an experimental basis. Accordingly, the
|
||||
program is provided without any warranty whatsoever, whether express,
|
||||
implied, statutory or otherwise. The term "warranty" used herein
|
||||
includes, but is not limited to, any warranty of the quality,
|
||||
performance, merchantability and fitness for a particular purpose of
|
||||
the program and the nonexistence of any infringement or violation of
|
||||
any right of any third party.
|
||||
|
||||
Each user of the program will agree and understand, and be deemed to
|
||||
have agreed and understood, that there is no warranty whatsoever for
|
||||
the program and, accordingly, the entire risk arising from or
|
||||
otherwise connected with the program is assumed by the user.
|
||||
|
||||
Therefore, neither ICOT, the copyright holder, or any other
|
||||
organization that participated in or was otherwise related to the
|
||||
development of the program and their respective officials, directors,
|
||||
officers and other employees shall be held liable for any and all
|
||||
damages, including, without limitation, general, special, incidental
|
||||
and consequential damages, arising out of or otherwise in connection
|
||||
with the use or inability to use the program or any product, material
|
||||
or result produced or otherwise obtained by using the program,
|
||||
regardless of whether they have been advised of, or otherwise had
|
||||
knowledge of, the possibility of such damages at any time during the
|
||||
project or thereafter. Each user will be deemed to have agreed to the
|
||||
foregoing by his or her commencement of use of the program. The term
|
||||
"use" as used herein includes, but is not limited to, the use,
|
||||
modification, copying and distribution of the program and the
|
||||
production of secondary products from the program.
|
||||
|
||||
In the case where the program, whether in its original form or
|
||||
modified, was distributed or delivered to or received by a user from
|
||||
any person, organization or entity other than ICOT, unless it makes or
|
||||
grants independently of ICOT any specific warranty to the user in
|
||||
writing, such person, organization or entity, will also be exempted
|
||||
from and not be held liable to the user for any such damages as noted
|
||||
above as far as the program is concerned.
|
|
@ -0,0 +1 @@
|
|||
a08e5ddd375ea17a878ba077cc33ce59e68758c2
|
|
@ -0,0 +1 @@
|
|||
88e5993f73c102f378c711f6e47221b7a9e22d25
|
|
@ -0,0 +1 @@
|
|||
94167b64752138a246cc33cbf1a3b0bfe5274b7c
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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.CharArraySet;
|
||||
import org.apache.lucene.analysis.uk.UkrainianMorfologikAnalyzer;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider;
|
||||
import org.elasticsearch.index.analysis.Analysis;
|
||||
|
||||
public class UkrainianAnalyzerProvider extends AbstractIndexAnalyzerProvider<UkrainianMorfologikAnalyzer> {
|
||||
|
||||
private final UkrainianMorfologikAnalyzer analyzer;
|
||||
|
||||
public UkrainianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) {
|
||||
super(indexSettings, name, settings);
|
||||
analyzer = new UkrainianMorfologikAnalyzer(Analysis.parseStopWords(env, settings, UkrainianMorfologikAnalyzer.getDefaultStopSet()),
|
||||
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
|
||||
analyzer.setVersion(version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UkrainianMorfologikAnalyzer get() {
|
||||
return this.analyzer;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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.plugin.analysis.ukrainian;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.elasticsearch.index.analysis.AnalyzerProvider;
|
||||
import org.elasticsearch.index.analysis.UkrainianAnalyzerProvider;
|
||||
import org.elasticsearch.indices.analysis.AnalysisModule.AnalysisProvider;
|
||||
import org.elasticsearch.plugins.AnalysisPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
||||
public class AnalysisUkrainianPlugin extends Plugin implements AnalysisPlugin {
|
||||
|
||||
@Override
|
||||
public Map<String, AnalysisProvider<AnalyzerProvider<? extends Analyzer>>> getAnalyzers() {
|
||||
return singletonMap("ukrainian", UkrainianAnalyzerProvider::new);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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.Analyzer;
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.plugin.analysis.ukrainian.AnalysisUkrainianPlugin;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class SimpleUkrainianAnalyzerTests extends ESTestCase {
|
||||
|
||||
public void testBasicUsage() throws Exception {
|
||||
testAnalyzer("чергу", "черга");
|
||||
testAnalyzer("рухається", "рухатися");
|
||||
testAnalyzer("колу", "кола", "коло", "кіл");
|
||||
testAnalyzer("Ця п'єса у свою чергу рухається по колу.", "п'єса", "черга", "рухатися", "кола", "коло", "кіл");
|
||||
}
|
||||
|
||||
private static void testAnalyzer(String source, String... expected_terms) throws IOException {
|
||||
TestAnalysis analysis = createTestAnalysis(new Index("test", "_na_"), Settings.EMPTY, new AnalysisUkrainianPlugin());
|
||||
Analyzer analyzer = analysis.indexAnalyzers.get("ukrainian").analyzer();
|
||||
TokenStream ts = analyzer.tokenStream("test", source);
|
||||
CharTermAttribute term1 = ts.addAttribute(CharTermAttribute.class);
|
||||
ts.reset();
|
||||
for (String expected : expected_terms) {
|
||||
assertThat(ts.incrementToken(), equalTo(true));
|
||||
assertThat(term1.toString(), equalTo(expected));
|
||||
}
|
||||
assertThat(ts.incrementToken(), equalTo(false));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.Analyzer;
|
||||
import org.apache.lucene.analysis.uk.UkrainianMorfologikAnalyzer;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.plugin.analysis.ukrainian.AnalysisUkrainianPlugin;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.hamcrest.MatcherAssert;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
|
||||
public class UkrainianAnalysisTests extends ESTestCase {
|
||||
|
||||
public void testDefaultsUkranianAnalysis() throws IOException {
|
||||
final TestAnalysis analysis = createTestAnalysis(new Index("test", "_na_"), Settings.EMPTY,
|
||||
new AnalysisUkrainianPlugin());
|
||||
|
||||
Analyzer analyzer = analysis.indexAnalyzers.get("ukrainian").analyzer();
|
||||
MatcherAssert.assertThat(analyzer, instanceOf(UkrainianMorfologikAnalyzer.class));
|
||||
}
|
||||
}
|
|
@ -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 com.carrotsearch.randomizedtesting.annotations.Name;
|
||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||
|
||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||
import org.elasticsearch.test.rest.yaml.parser.ClientYamlTestParseException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class UkrainianClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||
|
||||
public UkrainianClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||
super(testCandidate);
|
||||
}
|
||||
|
||||
@ParametersFactory
|
||||
public static Iterable<Object[]> parameters() throws IOException, ClientYamlTestParseException {
|
||||
return ESClientYamlSuiteTestCase.createParameters(0, 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Integration tests for Ukrainian analyzer
|
||||
---
|
||||
"Analyzer":
|
||||
- do:
|
||||
indices.analyze:
|
||||
body:
|
||||
text: колу
|
||||
analyzer: ukrainian
|
||||
- length: { tokens: 3 }
|
||||
- match: { tokens.0.token: кола }
|
||||
- match: { tokens.0.start_offset: 0 }
|
||||
- match: { tokens.0.end_offset: 4 }
|
||||
- match: { tokens.1.token: коло }
|
||||
- match: { tokens.1.start_offset: 0 }
|
||||
- match: { tokens.1.end_offset: 4 }
|
||||
- match: { tokens.2.token: кіл }
|
||||
- match: { tokens.2.start_offset: 0 }
|
||||
- match: { tokens.2.end_offset: 4 }
|
|
@ -0,0 +1,32 @@
|
|||
# Integration tests for Stempel analysis component
|
||||
#
|
||||
---
|
||||
"Index Stempel content":
|
||||
- do:
|
||||
indices.create:
|
||||
index: test
|
||||
body:
|
||||
mappings:
|
||||
type:
|
||||
properties:
|
||||
text:
|
||||
type: text
|
||||
analyzer: ukrainian
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: test
|
||||
type: type
|
||||
id: 1
|
||||
body: { "text": "Ця п'єса у свою чергу рухається по колу." }
|
||||
- do:
|
||||
indices.refresh: {}
|
||||
|
||||
- do:
|
||||
search:
|
||||
index: test
|
||||
body:
|
||||
query:
|
||||
match:
|
||||
text: кола
|
||||
- match: { hits.total: 1 }
|
|
@ -205,6 +205,10 @@ fi
|
|||
install_and_check_plugin analysis stempel
|
||||
}
|
||||
|
||||
@test "[$GROUP] install ukrainian plugin" {
|
||||
install_and_check_plugin analysis ukrainian morfologik-fsa-*.jar morfologik-stemming-*.jar
|
||||
}
|
||||
|
||||
@test "[$GROUP] install gce plugin" {
|
||||
install_and_check_plugin discovery gce google-api-client-*.jar
|
||||
}
|
||||
|
@ -341,6 +345,10 @@ fi
|
|||
remove_plugin analysis-stempel
|
||||
}
|
||||
|
||||
@test "[$GROUP] remove ukrainian plugin" {
|
||||
remove_plugin analysis-ukrainian
|
||||
}
|
||||
|
||||
@test "[$GROUP] remove gce plugin" {
|
||||
remove_plugin discovery-gce
|
||||
}
|
||||
|
|
|
@ -129,20 +129,28 @@ install_and_check_plugin() {
|
|||
shift
|
||||
|
||||
if [ "$prefix" == "-" ]; then
|
||||
local fullName="$name"
|
||||
local full_name="$name"
|
||||
else
|
||||
local fullName="$prefix-$name"
|
||||
local full_name="$prefix-$name"
|
||||
fi
|
||||
|
||||
install_jvm_plugin $fullName "$(readlink -m $fullName-*.zip)"
|
||||
install_jvm_plugin $full_name "$(readlink -m $full_name-*.zip)"
|
||||
|
||||
assert_module_or_plugin_directory "$ESPLUGINS/$fullName"
|
||||
assert_module_or_plugin_directory "$ESPLUGINS/$full_name"
|
||||
|
||||
# analysis plugins have a corresponding analyzers jar
|
||||
if [ $prefix == 'analysis' ]; then
|
||||
assert_module_or_plugin_file "$ESPLUGINS/$fullName/lucene-analyzers-$name-*.jar"
|
||||
local analyzer_jar_suffix=$name
|
||||
# the name of the analyzer jar for the ukrainian plugin does
|
||||
# not match the name of the plugin, so we have to make an
|
||||
# exception
|
||||
if [ $name == 'ukrainian' ]; then
|
||||
analyzer_jar_suffix='morfologik'
|
||||
fi
|
||||
assert_module_or_plugin_file "$ESPLUGINS/$full_name/lucene-analyzers-$analyzer_jar_suffix-*.jar"
|
||||
fi
|
||||
for file in "$@"; do
|
||||
assert_module_or_plugin_file "$ESPLUGINS/$fullName/$file"
|
||||
assert_module_or_plugin_file "$ESPLUGINS/$full_name/$file"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ List projects = [
|
|||
'plugins:analysis-phonetic',
|
||||
'plugins:analysis-smartcn',
|
||||
'plugins:analysis-stempel',
|
||||
'plugins:analysis-ukrainian',
|
||||
'plugins:discovery-azure-classic',
|
||||
'plugins:discovery-ec2',
|
||||
'plugins:discovery-file',
|
||||
|
|
|
@ -164,6 +164,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.elasticsearch.client.Requests.syncedFlushRequest;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
|
||||
|
@ -535,13 +536,10 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
|||
for (Discovery discovery : internalCluster().getInstances(Discovery.class)) {
|
||||
if (discovery instanceof ZenDiscovery) {
|
||||
final ZenDiscovery zenDiscovery = (ZenDiscovery) discovery;
|
||||
assertBusy(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
assertThat("still having pending states: " + Strings.arrayToDelimitedString(zenDiscovery.pendingClusterStates(), "\n"),
|
||||
zenDiscovery.pendingClusterStates(), emptyArray());
|
||||
}
|
||||
});
|
||||
assertBusy(() -> assertThat(zenDiscovery.localNode().getName() + " still having pending states: \n" +
|
||||
Arrays.stream(zenDiscovery.pendingClusterStates()).map(ClusterState::prettyPrint)
|
||||
.collect(Collectors.joining("\n")),
|
||||
zenDiscovery.pendingClusterStates(), emptyArray()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,9 +60,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
|
@ -299,7 +299,8 @@ public final class MockTransportService extends TransportService {
|
|||
final long startTime = System.currentTimeMillis();
|
||||
|
||||
addDelegate(transportAddress, new ClearableTransport(original) {
|
||||
private final Queue<Runnable> requestsToSendWhenCleared = new ConcurrentLinkedQueue<>();
|
||||
private final Queue<Runnable> requestsToSendWhenCleared = new LinkedBlockingDeque<Runnable>();
|
||||
private boolean cleared = false;
|
||||
|
||||
TimeValue getDelay() {
|
||||
return new TimeValue(duration.millis() - (System.currentTimeMillis() - startTime));
|
||||
|
@ -386,15 +387,24 @@ public final class MockTransportService extends TransportService {
|
|||
};
|
||||
|
||||
// store the request to send it once the rule is cleared.
|
||||
requestsToSendWhenCleared.add(runnable);
|
||||
|
||||
threadPool.schedule(delay, ThreadPool.Names.GENERIC, runnable);
|
||||
synchronized (this) {
|
||||
if (cleared) {
|
||||
runnable.run();
|
||||
} else {
|
||||
requestsToSendWhenCleared.add(runnable);
|
||||
threadPool.schedule(delay, ThreadPool.Names.GENERIC, runnable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void clearRule() {
|
||||
requestsToSendWhenCleared.forEach(Runnable::run);
|
||||
synchronized (this) {
|
||||
assert cleared == false;
|
||||
cleared = true;
|
||||
requestsToSendWhenCleared.forEach(Runnable::run);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue