SOLR-1338: use StringHelper.intern()

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@801981 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2009-08-07 12:54:26 +00:00
parent b51b515f6e
commit d02a4cfa03
5 changed files with 11 additions and 6 deletions

View File

@ -43,6 +43,7 @@ import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.*;
import org.apache.lucene.util.StringHelper;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.DOMUtil;
@ -155,7 +156,7 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
"QueryElevationComponent requires the schema to have a uniqueKeyField" );
}
idField = sf.getName().intern();
idField = StringHelper.intern(sf.getName());
forceElevation = initArgs.getBool( FORCE_ELEVATION, forceElevation );
try {

View File

@ -18,6 +18,7 @@ package org.apache.solr.handler.component;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermEnum;
import org.apache.lucene.util.StringHelper;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SolrParams;
@ -62,7 +63,7 @@ public class TermsComponent extends SearchComponent {
String prefix = params.get(TermsParams.TERMS_PREFIX_STR);
boolean raw = params.getBool(TermsParams.TERMS_RAW, false);
for (int j = 0; j < fields.length; j++) {
String field = fields[j].intern();
String field = StringHelper.intern(fields[j]);
FieldType ft = raw ? null : rb.req.getSchema().getFieldTypeNoEx(field);
if (ft==null) ft = new StrField();

View File

@ -19,6 +19,7 @@ package org.apache.solr.request;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.util.StringHelper;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.params.CommonParams;
@ -78,7 +79,7 @@ class JSONWriter extends TextResponseWriter {
public JSONWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) {
super(writer, req, rsp);
namedListStyle = req.getParams().get(JSON_NL_STYLE, JSON_NL_FLAT).intern();
namedListStyle = StringHelper.intern(req.getParams().get(JSON_NL_STYLE, JSON_NL_FLAT));
wrapperFunction = req.getParams().get(JSON_WRAPPER_FUNCTION);
}

View File

@ -20,6 +20,7 @@ import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.TermDocs;
import org.apache.lucene.index.TermEnum;
import org.apache.lucene.index.Term;
import org.apache.lucene.util.StringHelper;
import org.apache.solr.core.SolrCore;
import org.apache.solr.schema.SchemaField;
import org.apache.solr.schema.FieldType;
@ -206,7 +207,7 @@ public class FileFloatSource extends ValueSource {
BufferedReader r = new BufferedReader(new InputStreamReader(is));
String idName = ffs.keyField.getName().intern();
String idName = StringHelper.intern(ffs.keyField.getName());
FieldType idType = ffs.keyField.getType();
boolean sorted=true; // assume sorted until we discover it's not

View File

@ -24,6 +24,7 @@ import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermEnum;
import org.apache.lucene.search.spell.Dictionary;
import org.apache.lucene.util.StringHelper;
/**
* HighFrequencyDictionary: terms taken from the given field
@ -45,7 +46,7 @@ public class HighFrequencyDictionary implements Dictionary {
public HighFrequencyDictionary(IndexReader reader, String field, float thresh) {
this.reader = reader;
this.field = field.intern();
this.field = StringHelper.intern(field);
this.thresh = thresh;
}
@ -108,7 +109,7 @@ public class HighFrequencyDictionary implements Dictionary {
String currentField = actualTerm.field();
// if the next word doesn't have the same field return false
if (currentField != field) {
if (currentField != field) { // intern'd comparison
actualTerm = null;
return false;
}