mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
remove using Lucene StringHelper in the code
This commit is contained in:
parent
4c51ddd2ad
commit
a372643ca9
@ -19,7 +19,6 @@
|
||||
|
||||
package org.elasticsearch.cluster.node;
|
||||
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.elasticsearch.util.collect.ImmutableList;
|
||||
import org.elasticsearch.util.collect.ImmutableMap;
|
||||
import org.elasticsearch.util.collect.Maps;
|
||||
@ -63,7 +62,7 @@ public class DiscoveryNode implements Streamable, Serializable {
|
||||
|
||||
public static final ImmutableList<DiscoveryNode> EMPTY_LIST = ImmutableList.of();
|
||||
|
||||
private String nodeName = StringHelper.intern("");
|
||||
private String nodeName = "".intern();
|
||||
|
||||
private String nodeId;
|
||||
|
||||
@ -80,16 +79,16 @@ public class DiscoveryNode implements Streamable, Serializable {
|
||||
|
||||
public DiscoveryNode(String nodeName, String nodeId, TransportAddress address, Map<String, String> attributes) {
|
||||
if (nodeName == null) {
|
||||
this.nodeName = StringHelper.intern("");
|
||||
this.nodeName = "".intern();
|
||||
} else {
|
||||
this.nodeName = StringHelper.intern(nodeName);
|
||||
this.nodeName = nodeName.intern();
|
||||
}
|
||||
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
|
||||
for (Map.Entry<String, String> entry : attributes.entrySet()) {
|
||||
builder.put(StringHelper.intern(entry.getKey()), StringHelper.intern(entry.getValue()));
|
||||
builder.put(entry.getKey().intern(), entry.getValue().intern());
|
||||
}
|
||||
this.attributes = builder.build();
|
||||
this.nodeId = StringHelper.intern(nodeId);
|
||||
this.nodeId = nodeId.intern();
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
@ -183,13 +182,13 @@ public class DiscoveryNode implements Streamable, Serializable {
|
||||
}
|
||||
|
||||
@Override public void readFrom(StreamInput in) throws IOException {
|
||||
nodeName = StringHelper.intern(in.readUTF());
|
||||
nodeId = StringHelper.intern(in.readUTF());
|
||||
nodeName = in.readUTF().intern();
|
||||
nodeId = in.readUTF().intern();
|
||||
address = TransportAddressSerializers.addressFromStream(in);
|
||||
int size = in.readVInt();
|
||||
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
|
||||
for (int i = 0; i < size; i++) {
|
||||
builder.put(StringHelper.intern(in.readUTF()), StringHelper.intern(in.readUTF()));
|
||||
builder.put(in.readUTF().intern(), in.readUTF().intern());
|
||||
}
|
||||
attributes = builder.build();
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package org.elasticsearch.index;
|
||||
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.elasticsearch.util.concurrent.Immutable;
|
||||
import org.elasticsearch.util.io.stream.StreamInput;
|
||||
import org.elasticsearch.util.io.stream.StreamOutput;
|
||||
@ -41,7 +40,7 @@ public class Index implements Serializable, Streamable {
|
||||
}
|
||||
|
||||
public Index(String name) {
|
||||
this.name = StringHelper.intern(name);
|
||||
this.name = name.intern();
|
||||
}
|
||||
|
||||
public String name() {
|
||||
@ -78,7 +77,7 @@ public class Index implements Serializable, Streamable {
|
||||
}
|
||||
|
||||
@Override public void readFrom(StreamInput in) throws IOException {
|
||||
name = StringHelper.intern(in.readUTF());
|
||||
name = in.readUTF().intern();
|
||||
}
|
||||
|
||||
@Override public void writeTo(StreamOutput out) throws IOException {
|
||||
|
@ -19,12 +19,10 @@
|
||||
|
||||
package org.elasticsearch.index.mapper;
|
||||
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public interface AllFieldMapper extends FieldMapper<Void>, InternalMapper {
|
||||
|
||||
public static final String NAME = StringHelper.intern("_all");
|
||||
public static final String NAME = "_all";
|
||||
}
|
@ -25,7 +25,6 @@ import org.apache.lucene.document.Fieldable;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.Filter;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.elasticsearch.util.concurrent.Immutable;
|
||||
import org.elasticsearch.util.concurrent.ThreadSafe;
|
||||
|
||||
@ -47,10 +46,10 @@ public interface FieldMapper<T> {
|
||||
private final String fullName;
|
||||
|
||||
public Names(String name, String indexName, String indexNameClean, String fullName) {
|
||||
this.name = StringHelper.intern(name);
|
||||
this.indexName = StringHelper.intern(indexName);
|
||||
this.indexNameClean = StringHelper.intern(indexNameClean);
|
||||
this.fullName = StringHelper.intern(fullName);
|
||||
this.name = name.intern();
|
||||
this.indexName = indexName.intern();
|
||||
this.indexNameClean = indexNameClean.intern();
|
||||
this.fullName = fullName.intern();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,6 @@ package org.elasticsearch.index.mapper;
|
||||
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.FieldSelector;
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.elasticsearch.util.concurrent.ThreadSafe;
|
||||
|
||||
/**
|
||||
@ -32,7 +31,7 @@ import org.elasticsearch.util.concurrent.ThreadSafe;
|
||||
@ThreadSafe
|
||||
public interface SourceFieldMapper extends FieldMapper<byte[]>, InternalMapper {
|
||||
|
||||
public final String NAME = StringHelper.intern("_source");
|
||||
public final String NAME = "_source";
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if the source field mapper is enabled or not.
|
||||
|
@ -21,7 +21,6 @@ package org.elasticsearch.index.mapper;
|
||||
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.elasticsearch.util.concurrent.ThreadSafe;
|
||||
|
||||
/**
|
||||
@ -32,7 +31,7 @@ import org.elasticsearch.util.concurrent.ThreadSafe;
|
||||
@ThreadSafe
|
||||
public interface TypeFieldMapper extends FieldMapper<String>, InternalMapper {
|
||||
|
||||
public static final String NAME = StringHelper.intern("_type");
|
||||
public static final String NAME = "_type";
|
||||
|
||||
String value(Document document);
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
package org.elasticsearch.index.mapper;
|
||||
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.elasticsearch.util.concurrent.ThreadSafe;
|
||||
|
||||
/**
|
||||
@ -29,7 +28,7 @@ import org.elasticsearch.util.concurrent.ThreadSafe;
|
||||
@ThreadSafe
|
||||
public interface UidFieldMapper extends FieldMapper<Uid>, InternalMapper {
|
||||
|
||||
public static final String NAME = StringHelper.intern("_uid");
|
||||
public static final String NAME = "_uid";
|
||||
|
||||
Term term(String type, String id);
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package org.elasticsearch.index.query.xcontent;
|
||||
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.analysis.AnalysisService;
|
||||
import org.elasticsearch.index.settings.IndexSettings;
|
||||
@ -105,13 +104,13 @@ public class XContentQueryParserRegistry {
|
||||
|
||||
private void add(Map<String, XContentFilterParser> map, XContentFilterParser filterParser) {
|
||||
for (String name : filterParser.names()) {
|
||||
map.put(StringHelper.intern(name), filterParser);
|
||||
map.put(name.intern(), filterParser);
|
||||
}
|
||||
}
|
||||
|
||||
private void add(Map<String, XContentQueryParser> map, XContentQueryParser queryParser) {
|
||||
for (String name : queryParser.names()) {
|
||||
map.put(StringHelper.intern(name), queryParser);
|
||||
map.put(name.intern(), queryParser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package org.elasticsearch.util.xcontent.xson;
|
||||
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.elasticsearch.util.Bytes;
|
||||
import org.elasticsearch.util.Unicode;
|
||||
import org.elasticsearch.util.xcontent.XContentType;
|
||||
@ -88,7 +87,7 @@ public class XsonXContentParser extends AbstractXContentParser {
|
||||
xsonType = XsonType.FIELD_NAME;
|
||||
currentToken = Token.FIELD_NAME;
|
||||
// read the field name (interned)
|
||||
currentName = StringHelper.intern(inUTF());
|
||||
currentName = inUTF().intern();
|
||||
} else if (tokenType == XsonType.VALUE_STRING.code()) {
|
||||
xsonType = XsonType.VALUE_STRING;
|
||||
currentToken = Token.VALUE_STRING;
|
||||
|
Loading…
x
Reference in New Issue
Block a user