mirror of https://github.com/apache/lucene.git
SOLR-1930: remove deprecations
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1052738 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9dfc4951c9
commit
6e9e84c387
|
@ -1,31 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.common.util;
|
||||
|
||||
/**
|
||||
* @deprecated use JavaBinCodec instead
|
||||
*/
|
||||
@Deprecated
|
||||
public class NamedListCodec extends JavaBinCodec {
|
||||
public NamedListCodec() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NamedListCodec(ObjectResolver resolver) {
|
||||
super(resolver);
|
||||
}
|
||||
}
|
|
@ -1,243 +0,0 @@
|
|||
package org.apache.solr.handler;
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.
|
||||
*/
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.lucene.analysis.tokenattributes.*;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.ContentStream;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.common.util.SimpleOrderedMap;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.response.SolrQueryResponse;
|
||||
import org.apache.solr.schema.FieldType;
|
||||
import org.apache.solr.schema.IndexSchema;
|
||||
import org.apache.solr.schema.SchemaField;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamConstants;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated Use {@link org.apache.solr.handler.DocumentAnalysisRequestHandler} instead.
|
||||
**/
|
||||
@Deprecated
|
||||
public class AnalysisRequestHandler extends RequestHandlerBase {
|
||||
|
||||
public static Logger log = LoggerFactory.getLogger(AnalysisRequestHandler.class);
|
||||
|
||||
private XMLInputFactory inputFactory;
|
||||
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
super.init(args);
|
||||
|
||||
inputFactory = XMLInputFactory.newInstance();
|
||||
try {
|
||||
// The java 1.6 bundled stax parser (sjsxp) does not currently have a thread-safe
|
||||
// XMLInputFactory, as that implementation tries to cache and reuse the
|
||||
// XMLStreamReader. Setting the parser-specific "reuse-instance" property to false
|
||||
// prevents this.
|
||||
// All other known open-source stax parsers (and the bea ref impl)
|
||||
// have thread-safe factories.
|
||||
inputFactory.setProperty("reuse-instance", Boolean.FALSE);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// Other implementations will likely throw this exception since "reuse-instance"
|
||||
// isimplementation specific.
|
||||
log.debug("Unable to set the 'reuse-instance' property for the input factory: " + inputFactory);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
|
||||
SolrParams params = req.getParams();
|
||||
Iterable<ContentStream> streams = req.getContentStreams();
|
||||
if (streams != null) {
|
||||
for (ContentStream stream : req.getContentStreams()) {
|
||||
Reader reader = stream.getReader();
|
||||
try {
|
||||
XMLStreamReader parser = inputFactory.createXMLStreamReader(reader);
|
||||
NamedList<Object> result = processContent(parser, req.getSchema());
|
||||
rsp.add("response", result);
|
||||
}
|
||||
finally {
|
||||
IOUtils.closeQuietly(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NamedList<Object> processContent(XMLStreamReader parser,
|
||||
IndexSchema schema) throws XMLStreamException, IOException {
|
||||
NamedList<Object> result = new SimpleOrderedMap<Object>();
|
||||
while (true) {
|
||||
int event = parser.next();
|
||||
switch (event) {
|
||||
case XMLStreamConstants.END_DOCUMENT: {
|
||||
parser.close();
|
||||
return result;
|
||||
}
|
||||
case XMLStreamConstants.START_ELEMENT: {
|
||||
String currTag = parser.getLocalName();
|
||||
if ("doc".equals(currTag)) {
|
||||
log.trace("Tokenizing doc...");
|
||||
|
||||
SolrInputDocument doc = readDoc(parser);
|
||||
SchemaField uniq = schema.getUniqueKeyField();
|
||||
NamedList<NamedList<NamedList<Object>>> theTokens = new SimpleOrderedMap<NamedList<NamedList<Object>>>();
|
||||
result.add(doc.getFieldValue(uniq.getName()).toString(), theTokens);
|
||||
for (String name : doc.getFieldNames()) {
|
||||
FieldType ft = schema.getFieldType(name);
|
||||
Analyzer analyzer = ft.getAnalyzer();
|
||||
Collection<Object> vals = doc.getFieldValues(name);
|
||||
for (Object val : vals) {
|
||||
Reader reader = new StringReader(val.toString());
|
||||
TokenStream tstream = analyzer.tokenStream(name, reader);
|
||||
NamedList<NamedList<Object>> tokens = getTokens(tstream);
|
||||
theTokens.add(name, tokens);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static NamedList<NamedList<Object>> getTokens(TokenStream tstream) throws IOException {
|
||||
// outer is namedList since order of tokens is important
|
||||
NamedList<NamedList<Object>> tokens = new NamedList<NamedList<Object>>();
|
||||
// TODO: support custom attributes
|
||||
CharTermAttribute termAtt = null;
|
||||
TermToBytesRefAttribute bytesAtt = null;
|
||||
if (tstream.hasAttribute(CharTermAttribute.class)) {
|
||||
termAtt = tstream.getAttribute(CharTermAttribute.class);
|
||||
} else if (tstream.hasAttribute(TermToBytesRefAttribute.class)) {
|
||||
bytesAtt = tstream.getAttribute(TermToBytesRefAttribute.class);
|
||||
}
|
||||
final OffsetAttribute offsetAtt = tstream.addAttribute(OffsetAttribute.class);
|
||||
final TypeAttribute typeAtt = tstream.addAttribute(TypeAttribute.class);
|
||||
final PositionIncrementAttribute posIncAtt = tstream.addAttribute(PositionIncrementAttribute.class);
|
||||
|
||||
final BytesRef bytes = new BytesRef();
|
||||
while (tstream.incrementToken()) {
|
||||
NamedList<Object> token = new SimpleOrderedMap<Object>();
|
||||
tokens.add("token", token);
|
||||
if (termAtt != null) {
|
||||
token.add("value", termAtt.toString());
|
||||
}
|
||||
if (bytesAtt != null) {
|
||||
bytesAtt.toBytesRef(bytes);
|
||||
// TODO: This is incorrect when numeric fields change in later lucene versions. It should use BytesRef directly!
|
||||
token.add("value", bytes.utf8ToString());
|
||||
}
|
||||
token.add("start", offsetAtt.startOffset());
|
||||
token.add("end", offsetAtt.endOffset());
|
||||
token.add("posInc", posIncAtt.getPositionIncrement());
|
||||
token.add("type", typeAtt.type());
|
||||
//TODO: handle payloads
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
SolrInputDocument readDoc(XMLStreamReader parser) throws XMLStreamException {
|
||||
SolrInputDocument doc = new SolrInputDocument();
|
||||
|
||||
StringBuilder text = new StringBuilder();
|
||||
String name = null;
|
||||
String attrName = "";
|
||||
float boost = 1.0f;
|
||||
boolean isNull = false;
|
||||
while (true) {
|
||||
int event = parser.next();
|
||||
switch (event) {
|
||||
// Add everything to the text
|
||||
case XMLStreamConstants.SPACE:
|
||||
case XMLStreamConstants.CDATA:
|
||||
case XMLStreamConstants.CHARACTERS:
|
||||
text.append(parser.getText());
|
||||
break;
|
||||
|
||||
case XMLStreamConstants.END_ELEMENT:
|
||||
if ("doc".equals(parser.getLocalName())) {
|
||||
return doc;
|
||||
} else if ("field".equals(parser.getLocalName())) {
|
||||
if (!isNull) {
|
||||
doc.addField(name, text.toString(), boost);
|
||||
boost = 1.0f;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case XMLStreamConstants.START_ELEMENT:
|
||||
text.setLength(0);
|
||||
String localName = parser.getLocalName();
|
||||
if (!"field".equals(localName)) {
|
||||
log.warn("unexpected XML tag doc/" + localName);
|
||||
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
|
||||
"unexpected XML tag doc/" + localName);
|
||||
}
|
||||
|
||||
String attrVal = "";
|
||||
for (int i = 0; i < parser.getAttributeCount(); i++) {
|
||||
attrName = parser.getAttributeLocalName(i);
|
||||
attrVal = parser.getAttributeValue(i);
|
||||
if ("name".equals(attrName)) {
|
||||
name = attrVal;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////// SolrInfoMBeans methods //////////////////////
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Provide Analysis of text";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "$Revision$";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSourceId() {
|
||||
return "$Id$";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSource() {
|
||||
return "$URL$";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,175 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.handler;
|
||||
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.search.DisMaxQParserPlugin;
|
||||
import org.apache.solr.search.QueryParsing;
|
||||
import org.apache.solr.util.SolrPluginUtils;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* A Generic query plugin designed to be given a simple query expression
|
||||
* from a user, which it will then query against a variety of
|
||||
* pre-configured fields, in a variety of ways, using BooleanQueries,
|
||||
* DisjunctionMaxQueries, and PhraseQueries.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* All of the following options may be configured for this plugin
|
||||
* in the solrconfig as defaults, and may be overriden as request parameters
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>q.alt - An alternate query to be used in cases where the main
|
||||
* query (q) is not specified (or blank). This query should
|
||||
* be expressed in the Standard SolrQueryParser syntax (you
|
||||
* can use <code>q.alt=*:*</code> to denote that all documents
|
||||
* should be returned when no query is specified)
|
||||
* </li>
|
||||
* <li>tie - (Tie breaker) float value to use as tiebreaker in
|
||||
* DisjunctionMaxQueries (should be something much less than 1)
|
||||
* </li>
|
||||
* <li> qf - (Query Fields) fields and boosts to use when building
|
||||
* DisjunctionMaxQueries from the users query. Format is:
|
||||
* "<code>fieldA^1.0 fieldB^2.2</code>".
|
||||
* This param can be specified multiple times, and the fields
|
||||
* are additive.
|
||||
* </li>
|
||||
* <li> mm - (Minimum Match) this supports a wide variety of
|
||||
* complex expressions.
|
||||
* read {@link SolrPluginUtils#setMinShouldMatch SolrPluginUtils.setMinShouldMatch} and <a href="http://lucene.apache.org/solr/api/org/apache/solr/util/doc-files/min-should-match.html">mm expression format</a> for details.
|
||||
* </li>
|
||||
* <li> pf - (Phrase Fields) fields/boosts to make phrase queries out
|
||||
* of, to boost the users query for exact matches on the specified fields.
|
||||
* Format is: "<code>fieldA^1.0 fieldB^2.2</code>".
|
||||
* This param can be specified multiple times, and the fields
|
||||
* are additive.
|
||||
* </li>
|
||||
* <li> ps - (Phrase Slop) amount of slop on phrase queries built for pf
|
||||
* fields.
|
||||
* </li>
|
||||
* <li> qs - (Query Slop) amount of slop on phrase queries explicitly
|
||||
* specified in the "q" for qf fields.
|
||||
* </li>
|
||||
* <li> bq - (Boost Query) a raw lucene query that will be included in the
|
||||
* users query to influence the score. If this is a BooleanQuery
|
||||
* with a default boost (1.0f), then the individual clauses will be
|
||||
* added directly to the main query. Otherwise, the query will be
|
||||
* included as is.
|
||||
* This param can be specified multiple times, and the boosts are
|
||||
* are additive. NOTE: the behaviour listed above is only in effect
|
||||
* if a single <code>bq</code> paramter is specified. Hence you can
|
||||
* disable it by specifying an additional, blank, <code>bq</code>
|
||||
* parameter.
|
||||
* </li>
|
||||
* <li> bf - (Boost Functions) functions (with optional boosts) that will be
|
||||
* included in the users query to influence the score.
|
||||
* Format is: "<code>funcA(arg1,arg2)^1.2
|
||||
* funcB(arg3,arg4)^2.2</code>". NOTE: Whitespace is not allowed
|
||||
* in the function arguments.
|
||||
* This param can be specified multiple times, and the functions
|
||||
* are additive.
|
||||
* </li>
|
||||
* <li> fq - (Filter Query) a raw lucene query that can be used
|
||||
* to restrict the super set of products we are interested in - more
|
||||
* efficient then using bq, but doesn't influence score.
|
||||
* This param can be specified multiple times, and the filters
|
||||
* are additive.
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>
|
||||
* The following options are only available as request params...
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li> q - (Query) the raw unparsed, unescaped, query from the user.
|
||||
* </li>
|
||||
* <li>sort - (Order By) list of fields and direction to sort on.
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
* <pre>
|
||||
* :TODO: document facet param support
|
||||
*
|
||||
* </pre>
|
||||
* @deprecated use StandardRequestHandler with a "defType=dismax" param
|
||||
*/
|
||||
@Deprecated
|
||||
public class DisMaxRequestHandler extends StandardRequestHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
super.init( args );
|
||||
NamedList def = null;
|
||||
|
||||
// redo "defaults"
|
||||
Object o = args.get("defaults");
|
||||
if (o != null && o instanceof NamedList) {
|
||||
def = (NamedList)o;
|
||||
} else {
|
||||
// no explict defaults list, use all args implicitly
|
||||
// indexOf so "<null name="defaults"/> is valid indicator of no defaults
|
||||
def = args;
|
||||
}
|
||||
|
||||
// Make the default query type "dismax" if not specified
|
||||
if (def.get(QueryParsing.DEFTYPE) == null) {
|
||||
def = def.clone();
|
||||
def.add(QueryParsing.DEFTYPE, DisMaxQParserPlugin.NAME);
|
||||
defaults = SolrParams.toSolrParams( def );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////// SolrInfoMBeans methods //////////////////////
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "DisjunctionMax Request Handler: Does relevancy based queries "
|
||||
+ "across a variety of fields using configured boosts";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "$Revision$";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSourceId() {
|
||||
return "$Id$";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSource() {
|
||||
return "$URL$";
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL[] getDocs() {
|
||||
try {
|
||||
return new URL[] { new URL("http://wiki.apache.org/solr/DisMaxRequestHandler") };
|
||||
}
|
||||
catch( MalformedURLException ex ) { return null; }
|
||||
}
|
||||
}
|
|
@ -1,437 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.handler;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
import org.apache.lucene.search.spell.Dictionary;
|
||||
import org.apache.lucene.search.spell.SpellChecker;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.FSDirectory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.response.SolrQueryResponse;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.common.util.SimpleOrderedMap;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.util.HighFrequencyDictionary;
|
||||
import org.apache.solr.util.plugin.SolrCoreAware;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Takes a string (e.g. a query string) as the value of the "q" parameter
|
||||
* and looks up alternative spelling suggestions in the spellchecker.
|
||||
* The spellchecker used by this handler is the Lucene contrib SpellChecker.
|
||||
*
|
||||
<style>
|
||||
pre.code
|
||||
{
|
||||
border: 1pt solid #AEBDCC;
|
||||
background-color: #F3F5F7;
|
||||
padding: 5pt;
|
||||
font-family: courier, monospace;
|
||||
white-space: pre;
|
||||
// begin css 3 or browser specific rules - do not remove!
|
||||
//see: http://forums.techguy.org/archive/index.php/t-249849.html
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
white-space: -moz-pre-wrap;
|
||||
white-space: -pre-wrap;
|
||||
white-space: -o-pre-wrap;
|
||||
// end css 3 or browser specific rules
|
||||
}
|
||||
|
||||
</style>
|
||||
*
|
||||
* <p>The results identifies the original words echoing it as an entry with the
|
||||
* name of "words" and original word value. It
|
||||
* also identifies if the requested "words" is contained in the index through
|
||||
* the use of the exist true/false name value. Examples of these output
|
||||
* parameters in the standard output format is as follows:</p>
|
||||
* <pre class="code">
|
||||
<str name="words">facial</str>
|
||||
<str name="exist">true</str> </pre>
|
||||
*
|
||||
* <p>If a query string parameter of "extendedResults" is used, then each word within the
|
||||
* "q" parameter (seperated by a space or +) will
|
||||
* be iterated through the spell checker and will be wrapped in an
|
||||
* NamedList. Each word will then get its own set of results: words, exists, and
|
||||
* suggestions.</p>
|
||||
* <P><bold>NOTE</bold>: Query terms are simply split on whitespace when using extendedResults mode. This is may not be adequate.
|
||||
* See the {@link org.apache.solr.handler.component.SpellCheckComponent} for alternatives.
|
||||
* </P>
|
||||
* <p>Also note that multiword queries will be treated as a single term if extendedResults is false. This may or may not make sense
|
||||
* depending on how the spelling field was indexed.</p>
|
||||
*
|
||||
* <p>Examples of the use of the standard ouput (XML) without and with the
|
||||
* use of the "extendedResults" parameter are as follows.</p>
|
||||
*
|
||||
* <p> The following URL
|
||||
* examples were configured with the solr.SpellCheckerRequestHandler
|
||||
* named as "/spellchecker".</p>
|
||||
*
|
||||
* <p>Without the use of "extendedResults" and one word
|
||||
* spelled correctly: facial </p>
|
||||
* <pre class="code">http://.../spellchecker?indent=on&onlyMorePopular=true&accuracy=.6&suggestionCount=20&q=facial</pre>
|
||||
* <pre class="code">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<response>
|
||||
|
||||
<lst name="responseHeader">
|
||||
<int name="status">0</int>
|
||||
<int name="QTime">6</int>
|
||||
</lst>
|
||||
<str name="words">facial</str>
|
||||
<str name="exist">true</str>
|
||||
<arr name="suggestions">
|
||||
<str>faciale</str>
|
||||
<str>faucial</str>
|
||||
<str>fascial</str>
|
||||
<str>facing</str>
|
||||
<str>faciei</str>
|
||||
<str>facialis</str>
|
||||
<str>social</str>
|
||||
<str>facile</str>
|
||||
<str>spacial</str>
|
||||
<str>glacial</str>
|
||||
<str>marcial</str>
|
||||
<str>facies</str>
|
||||
<str>facio</str>
|
||||
</arr>
|
||||
</response> </pre>
|
||||
*
|
||||
* <p>Without the use of "extendedResults" and two words,
|
||||
* one spelled correctly and one misspelled: facial salophosphoprotein </p>
|
||||
* <pre class="code">http://.../spellchecker?indent=on&onlyMorePopular=true&accuracy=.6&suggestionCount=20&q=facial+salophosphoprotein</pre>
|
||||
* <pre class="code">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<response>
|
||||
|
||||
<lst name="responseHeader">
|
||||
<int name="status">0</int>
|
||||
<int name="QTime">18</int>
|
||||
</lst>
|
||||
<str name="words">facial salophosphoprotein</str>
|
||||
<str name="exist">false</str>
|
||||
<arr name="suggestions">
|
||||
<str>sialophosphoprotein</str>
|
||||
</arr>
|
||||
</response> </pre>
|
||||
*
|
||||
*
|
||||
* <p>With the use of "extendedResults" and two words,
|
||||
* one spelled correctly and one misspelled: facial salophosphoprotein </p>
|
||||
* <pre class="code">http://.../spellchecker?indent=on&onlyMorePopular=true&accuracy=.6&suggestionCount=20&extendedResults=true&q=facial+salophosphoprotein</pre>
|
||||
* <pre class="code">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<response>
|
||||
|
||||
<lst name="responseHeader">
|
||||
<int name="status">0</int>
|
||||
<int name="QTime">23</int>
|
||||
</lst>
|
||||
<lst name="result">
|
||||
<lst name="facial">
|
||||
<int name="frequency">1</int>
|
||||
<lst name="suggestions">
|
||||
<lst name="faciale"><int name="frequency">1</int></lst>
|
||||
<lst name="faucial"><int name="frequency">1</int></lst>
|
||||
<lst name="fascial"><int name="frequency">1</int></lst>
|
||||
<lst name="facing"><int name="frequency">1</int></lst>
|
||||
<lst name="faciei"><int name="frequency">1</int></lst>
|
||||
<lst name="facialis"><int name="frequency">1</int></lst>
|
||||
<lst name="social"><int name="frequency">1</int></lst>
|
||||
<lst name="facile"><int name="frequency">1</int></lst>
|
||||
<lst name="spacial"><int name="frequency">1</int></lst>
|
||||
<lst name="glacial"><int name="frequency">1</int></lst>
|
||||
<lst name="marcial"><int name="frequency">1</int></lst>
|
||||
<lst name="facies"><int name="frequency">1</int></lst>
|
||||
<lst name="facio"><int name="frequency">1</int></lst>
|
||||
</lst>
|
||||
</lst>
|
||||
<lst name="salophosphoprotein">
|
||||
<int name="frequency">0</int>
|
||||
<lst name="suggestions">
|
||||
<lst name="sialophosphoprotein"><int name="frequency">1</int></lst>
|
||||
<lst name="phosphoprotein"><int name="frequency">1</int></lst>
|
||||
<lst name="phosphoproteins"><int name="frequency">1</int></lst>
|
||||
<lst name="alphalipoprotein"><int name="frequency">1</int></lst>
|
||||
</lst>
|
||||
</lst>
|
||||
</lst>
|
||||
</response> </pre>
|
||||
|
||||
*
|
||||
* @see <a href="http://wiki.apache.org/jakarta-lucene/SpellChecker">The Lucene Spellchecker documentation</a>
|
||||
*
|
||||
*
|
||||
* @deprecated Use {@link org.apache.solr.handler.component.SpellCheckComponent} instead.
|
||||
*
|
||||
* See also https://issues.apache.org/jira/browse/SOLR-474 and https://issues.apache.org/jira/browse/SOLR-485
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class SpellCheckerRequestHandler extends RequestHandlerBase implements SolrCoreAware {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(SpellCheckerRequestHandler.class);
|
||||
|
||||
private SpellChecker spellChecker;
|
||||
|
||||
/*
|
||||
* From http://wiki.apache.org/jakarta-lucene/SpellChecker
|
||||
* If reader and restrictToField are both not null:
|
||||
* 1. The returned words are restricted only to the words presents in the field
|
||||
* "restrictToField "of the Lucene Index "reader".
|
||||
*
|
||||
* 2. The list is also sorted with a second criterium: the popularity (the
|
||||
* frequence) of the word in the user field.
|
||||
*
|
||||
* 3. If "onlyMorePopular" is true and the mispelled word exist in the user field,
|
||||
* return only the words more frequent than this.
|
||||
*
|
||||
*/
|
||||
|
||||
protected Directory spellcheckerIndexDir = new RAMDirectory();
|
||||
protected String dirDescription = "(ramdir)";
|
||||
protected String termSourceField;
|
||||
|
||||
protected static final String PREFIX = "sp.";
|
||||
protected static final String QUERY_PREFIX = PREFIX + "query.";
|
||||
protected static final String DICTIONARY_PREFIX = PREFIX + "dictionary.";
|
||||
|
||||
protected static final String SOURCE_FIELD = DICTIONARY_PREFIX + "termSourceField";
|
||||
protected static final String INDEX_DIR = DICTIONARY_PREFIX + "indexDir";
|
||||
protected static final String THRESHOLD = DICTIONARY_PREFIX + "threshold";
|
||||
|
||||
protected static final String ACCURACY = QUERY_PREFIX + "accuracy";
|
||||
protected static final String SUGGESTIONS = QUERY_PREFIX + "suggestionCount";
|
||||
protected static final String POPULAR = QUERY_PREFIX + "onlyMorePopular";
|
||||
protected static final String EXTENDED = QUERY_PREFIX + "extendedResults";
|
||||
|
||||
protected static final float DEFAULT_ACCURACY = 0.5f;
|
||||
protected static final int DEFAULT_SUGGESTION_COUNT = 1;
|
||||
protected static final boolean DEFAULT_MORE_POPULAR = false;
|
||||
protected static final boolean DEFAULT_EXTENDED_RESULTS = false;
|
||||
protected static final float DEFAULT_DICTIONARY_THRESHOLD = 0.0f;
|
||||
|
||||
protected SolrParams args = null;
|
||||
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
super.init(args);
|
||||
this.args = SolrParams.toSolrParams(args);
|
||||
}
|
||||
|
||||
public void inform(SolrCore core)
|
||||
{
|
||||
termSourceField = args.get(SOURCE_FIELD, args.get("termSourceField"));
|
||||
try {
|
||||
String dir = args.get(INDEX_DIR, args.get("spellcheckerIndexDir"));
|
||||
if (null != dir) {
|
||||
File f = new File(dir);
|
||||
if ( ! f.isAbsolute() ) {
|
||||
f = new File(core.getDataDir(), dir);
|
||||
}
|
||||
dirDescription = f.getAbsolutePath();
|
||||
log.info("using spell directory: " + dirDescription);
|
||||
spellcheckerIndexDir = FSDirectory.open(f);
|
||||
} else {
|
||||
log.info("using RAM based spell directory");
|
||||
}
|
||||
spellChecker = new SpellChecker(spellcheckerIndexDir);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Cannot open SpellChecker index", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the following query string parameters: q, extendedResults, cmd rebuild,
|
||||
* cmd reopen, accuracy, suggestionCount, restrictToField, and onlyMorePopular.
|
||||
*/
|
||||
@Override
|
||||
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)
|
||||
throws Exception {
|
||||
SolrParams p = req.getParams();
|
||||
String words = p.get("q");
|
||||
String cmd = p.get("cmd");
|
||||
if (cmd != null) {
|
||||
cmd = cmd.trim();
|
||||
if (cmd.equals("rebuild")) {
|
||||
rebuild(req);
|
||||
rsp.add("cmdExecuted","rebuild");
|
||||
} else if (cmd.equals("reopen")) {
|
||||
reopen();
|
||||
rsp.add("cmdExecuted","reopen");
|
||||
} else {
|
||||
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Unrecognized Command: " + cmd);
|
||||
}
|
||||
}
|
||||
|
||||
// empty query string
|
||||
if (null == words || "".equals(words.trim())) {
|
||||
return;
|
||||
}
|
||||
|
||||
IndexReader indexReader = null;
|
||||
String suggestionField = null;
|
||||
Float accuracy;
|
||||
int numSug;
|
||||
boolean onlyMorePopular;
|
||||
boolean extendedResults;
|
||||
try {
|
||||
accuracy = p.getFloat(ACCURACY, p.getFloat("accuracy", DEFAULT_ACCURACY));
|
||||
spellChecker.setAccuracy(accuracy);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RuntimeException("Accuracy must be a valid positive float", e);
|
||||
}
|
||||
try {
|
||||
numSug = p.getInt(SUGGESTIONS, p.getInt("suggestionCount", DEFAULT_SUGGESTION_COUNT));
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RuntimeException("Spelling suggestion count must be a valid positive integer", e);
|
||||
}
|
||||
try {
|
||||
onlyMorePopular = p.getBool(POPULAR, DEFAULT_MORE_POPULAR);
|
||||
} catch (SolrException e) {
|
||||
throw new RuntimeException("'Only more popular' must be a valid boolean", e);
|
||||
}
|
||||
try {
|
||||
extendedResults = p.getBool(EXTENDED, DEFAULT_EXTENDED_RESULTS);
|
||||
} catch (SolrException e) {
|
||||
throw new RuntimeException("'Extended results' must be a valid boolean", e);
|
||||
}
|
||||
|
||||
// when searching for more popular, a non null index-reader and
|
||||
// restricted-field are required
|
||||
if (onlyMorePopular || extendedResults) {
|
||||
indexReader = req.getSearcher().getReader();
|
||||
suggestionField = termSourceField;
|
||||
}
|
||||
|
||||
if (extendedResults) {
|
||||
|
||||
rsp.add("numDocs", indexReader.numDocs());
|
||||
|
||||
SimpleOrderedMap<Object> results = new SimpleOrderedMap<Object>();
|
||||
String[] wordz = words.split(" ");
|
||||
for (String word : wordz)
|
||||
{
|
||||
SimpleOrderedMap<Object> nl = new SimpleOrderedMap<Object>();
|
||||
nl.add("frequency", indexReader.docFreq(new Term(suggestionField, word)));
|
||||
String[] suggestions =
|
||||
spellChecker.suggestSimilar(word, numSug,
|
||||
indexReader, suggestionField, onlyMorePopular);
|
||||
|
||||
// suggestion array
|
||||
NamedList<Object> sa = new NamedList<Object>();
|
||||
for (int i=0; i<suggestions.length; i++) {
|
||||
// suggestion item
|
||||
SimpleOrderedMap<Object> si = new SimpleOrderedMap<Object>();
|
||||
si.add("frequency", indexReader.docFreq(new Term(termSourceField, suggestions[i])));
|
||||
sa.add(suggestions[i], si);
|
||||
}
|
||||
nl.add("suggestions", sa);
|
||||
results.add(word, nl);
|
||||
}
|
||||
rsp.add( "result", results );
|
||||
|
||||
} else {
|
||||
rsp.add("words", words);
|
||||
if (spellChecker.exist(words)) {
|
||||
rsp.add("exist","true");
|
||||
} else {
|
||||
rsp.add("exist","false");
|
||||
}
|
||||
String[] suggestions =
|
||||
spellChecker.suggestSimilar(words, numSug,
|
||||
indexReader, suggestionField,
|
||||
onlyMorePopular);
|
||||
|
||||
rsp.add("suggestions", Arrays.asList(suggestions));
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns a dictionary to be used when building the spell-checker index.
|
||||
* Override the method for custom dictionary
|
||||
*/
|
||||
protected Dictionary getDictionary(SolrQueryRequest req) {
|
||||
float threshold;
|
||||
try {
|
||||
threshold = req.getParams().getFloat(THRESHOLD, DEFAULT_DICTIONARY_THRESHOLD);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RuntimeException("Threshold must be a valid positive float", e);
|
||||
}
|
||||
IndexReader indexReader = req.getSearcher().getReader();
|
||||
return new HighFrequencyDictionary(indexReader, termSourceField, threshold);
|
||||
}
|
||||
|
||||
/** Rebuilds the SpellChecker index using values from the <code>termSourceField</code> from the
|
||||
* index pointed to by the current {@link IndexSearcher}.
|
||||
* Any word appearing in less that thresh documents will not be added to the spellcheck index.
|
||||
*/
|
||||
private void rebuild(SolrQueryRequest req) throws IOException, SolrException {
|
||||
if (null == termSourceField) {
|
||||
throw new SolrException
|
||||
(SolrException.ErrorCode.SERVER_ERROR, "can't rebuild spellchecker index without termSourceField configured");
|
||||
}
|
||||
|
||||
Dictionary dictionary = getDictionary(req);
|
||||
spellChecker.clearIndex();
|
||||
spellChecker.indexDictionary(dictionary);
|
||||
reopen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reopens the SpellChecker index directory.
|
||||
* Useful if an external process is responsible for building
|
||||
* the spell checker index.
|
||||
*/
|
||||
private void reopen() throws IOException {
|
||||
spellChecker.setSpellIndex(spellcheckerIndexDir);
|
||||
}
|
||||
|
||||
//////////////////////// SolrInfoMBeans methods //////////////////////
|
||||
|
||||
public String getVersion() {
|
||||
return "$Revision$";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "The SpellChecker Solr request handler for SpellChecker index: " + dirDescription;
|
||||
}
|
||||
|
||||
public String getSourceId() {
|
||||
return "$Id$";
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return "$URL$";
|
||||
}
|
||||
|
||||
public URL[] getDocs() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
|
||||
/**
|
||||
* This class is scheduled for deletion. Please update your code to the moved package.
|
||||
*
|
||||
* @deprecated Use org.apache.solr.common.params.AppendedSolrParams
|
||||
*/
|
||||
@Deprecated
|
||||
public class AppendedSolrParams extends org.apache.solr.common.params.AppendedSolrParams {
|
||||
// Don't use this class
|
||||
public AppendedSolrParams(SolrParams main, SolrParams extra) {
|
||||
super(main, extra);
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package org.apache.solr.request;
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.BinaryQueryResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public interface BinaryQueryResponseWriter extends org.apache.solr.response.BinaryQueryResponseWriter
|
||||
{
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.BinaryResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public class BinaryResponseWriter extends org.apache.solr.response.BinaryResponseWriter
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(BinaryResponseWriter.class.getName());
|
||||
|
||||
public BinaryResponseWriter(){
|
||||
super();
|
||||
log.warn(BinaryResponseWriter.class.getName()+" is deprecated. Please use the corresponding class in org.apache.solr.response");
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
|
||||
/**
|
||||
* This class is scheduled for deletion. Please update your code to the moved package.
|
||||
*
|
||||
* @deprecated Use org.apache.solr.common.params.DefaultSolrParams.
|
||||
*/
|
||||
@Deprecated
|
||||
public class DefaultSolrParams extends org.apache.solr.common.params.DefaultSolrParams {
|
||||
// Don't use this class
|
||||
public DefaultSolrParams(SolrParams main, SolrParams extra) {
|
||||
super(main, extra);
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
/**
|
||||
* This class is scheduled for deletion. Please update your code to the moved package.
|
||||
* @deprecated use org.apache.solr.handler.DisMaxRequestHandler
|
||||
*/
|
||||
@Deprecated
|
||||
public class DisMaxRequestHandler extends org.apache.solr.handler.DisMaxRequestHandler {
|
||||
// Don't use this class
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.JSONResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public class JSONResponseWriter extends org.apache.solr.response.JSONResponseWriter
|
||||
{
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(JSONResponseWriter.class.getName());
|
||||
|
||||
public JSONResponseWriter(){
|
||||
super();
|
||||
log.warn(JSONResponseWriter.class.getName()+" is deprecated. Please use the corresponding class in org.apache.solr.response");
|
||||
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is scheduled for deletion. Please update your code to the moved package.
|
||||
*
|
||||
* @deprecated Use org.apache.solr.common.params.MapSolrParams
|
||||
*/
|
||||
@Deprecated
|
||||
public class MapSolrParams extends org.apache.solr.common.params.MapSolrParams {
|
||||
|
||||
public MapSolrParams(Map<String, String> map) {
|
||||
super(map);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is scheduled for deletion. Please update your code to the moved package.
|
||||
*
|
||||
* @deprecated Use org.apache.solr.common.params.MultiMapSolrParams.
|
||||
*/
|
||||
@Deprecated
|
||||
public class MultiMapSolrParams extends org.apache.solr.common.params.MultiMapSolrParams {
|
||||
public MultiMapSolrParams(Map<String, String[]> map) {
|
||||
super(map);
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.PHPResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public class PHPResponseWriter extends org.apache.solr.response.PHPResponseWriter
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(PHPResponseWriter.class.getName());
|
||||
|
||||
|
||||
public PHPResponseWriter(){
|
||||
super();
|
||||
log.warn(PHPResponseWriter.class.getName()+" is deprecated. Please use the corresponding class in org.apache.solr.response");
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.PHPSerializedResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public class PHPSerializedResponseWriter extends org.apache.solr.response.PHPSerializedResponseWriter
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(PHPSerializedResponseWriter.class.getName());
|
||||
|
||||
public PHPSerializedResponseWriter(){
|
||||
super();
|
||||
log.warn(PHPSerializedResponseWriter.class.getName()+" is deprecated. Please use the corresponding class in org.apache.solr.response");
|
||||
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.PythonResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public class PythonResponseWriter extends org.apache.solr.response.PythonResponseWriter
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(PythonResponseWriter.class.getName());
|
||||
|
||||
public PythonResponseWriter(){
|
||||
super();
|
||||
log.warn(PythonResponseWriter.class.getName()+" is deprecated. Please use the corresponding class in org.apache.solr.response");
|
||||
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.QueryResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public interface QueryResponseWriter extends org.apache.solr.response.QueryResponseWriter
|
||||
{
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.RawResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public class RawResponseWriter extends org.apache.solr.response.RawResponseWriter
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(RawResponseWriter.class.getName());
|
||||
|
||||
|
||||
public RawResponseWriter(){
|
||||
super();
|
||||
log.warn(RawResponseWriter.class.getName()+" is deprecated. Please use the corresponding class in org.apache.solr.response");
|
||||
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
|
||||
/**
|
||||
* This class is scheduled for deletion. Please update your code to the moved package.
|
||||
*
|
||||
* @deprecated Use org.apache.solr.common.params.RequiredSolrParams.
|
||||
*/
|
||||
@Deprecated
|
||||
public class RequiredSolrParams extends org.apache.solr.common.params.RequiredSolrParams {
|
||||
|
||||
public RequiredSolrParams(SolrParams params) {
|
||||
super(params);
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.RubyResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public class RubyResponseWriter extends org.apache.solr.response.RubyResponseWriter
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(RubyResponseWriter.class.getName());
|
||||
|
||||
|
||||
public RubyResponseWriter(){
|
||||
super();
|
||||
log.warn(RubyResponseWriter.class.getName()+" is deprecated. Please use the corresponding class in org.apache.solr.response");
|
||||
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
import org.apache.solr.common.params.FacetParams;
|
||||
|
||||
|
||||
/**
|
||||
* This class is scheduled for deletion. Please update your code to the moved package.
|
||||
*
|
||||
* @deprecated Use org.apache.solr.common.params.SolrParams.
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class SolrParams extends org.apache.solr.common.params.SolrParams
|
||||
implements FacetParams, CommonParams // keep the same constants it used to have
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.SolrQueryResponse
|
||||
*/
|
||||
@Deprecated
|
||||
public class SolrQueryResponse extends org.apache.solr.response.SolrQueryResponse
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(SolrQueryResponse.class.getName());
|
||||
|
||||
public SolrQueryResponse() {
|
||||
super();
|
||||
log.warn(SolrQueryResponse.class.getName()+" is deprecated. Please use the corresponding class in org.apache.solr.response");
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
/**
|
||||
* This class is scheduled for deletion. Please update your code to the moved package.
|
||||
* @deprecated use org.apache.solr.handler.StandardRequestHandler
|
||||
*/
|
||||
@Deprecated
|
||||
public class StandardRequestHandler extends org.apache.solr.handler.StandardRequestHandler {
|
||||
// Don't use this class
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.solr.response.SolrQueryResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.TextResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class TextResponseWriter extends org.apache.solr.response.TextResponseWriter
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(TextResponseWriter.class.getName());
|
||||
|
||||
public TextResponseWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) {
|
||||
super(writer, req, rsp);
|
||||
log.warn(TextResponseWriter.class.getName()+" is deprecated. Please use the corresponding class in org.apache.solr.response");
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.XMLResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public class XMLResponseWriter extends org.apache.solr.response.XMLResponseWriter
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(XMLResponseWriter.class.getName());
|
||||
|
||||
|
||||
public XMLResponseWriter(){
|
||||
super();
|
||||
log.warn(XMLResponseWriter.class.getName()+" is deprecated. Please use the corresponding class in org.apache.solr.response");
|
||||
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.request;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use org.apache.solr.response.XSLTResponseWriter
|
||||
*/
|
||||
@Deprecated
|
||||
public class XSLTResponseWriter extends org.apache.solr.response.XSLTResponseWriter
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(XSLTResponseWriter.class.getName());
|
||||
|
||||
|
||||
public XSLTResponseWriter(){
|
||||
super();
|
||||
log.warn(XSLTResponseWriter.class.getName()+" is deprecated. Please use the corresponding class in org.apache.solr.response");
|
||||
|
||||
}
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.schema;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* This class is <b>NOT</b> recommended for new users and should be
|
||||
* considered <b>UNSUPPORTED</b>.
|
||||
* <p>
|
||||
* In Solr 1.2, <tt>DateField</tt> did not enforce
|
||||
* the canonical representation of the ISO 8601 format when parsing
|
||||
* incoming data, and did not generation the canonical format when
|
||||
* generating dates from "Date Math" strings (particularly as
|
||||
* it pertains to milliseconds ending in trailing zeros) -- As a result
|
||||
* equivalent dates could not always be compared properly.
|
||||
* </p>
|
||||
* <p>
|
||||
* This class is provided as possible alternative for people who depend on
|
||||
* the "broken" behavior of DateField in Solr 1.2
|
||||
* (specificly: accepting any input that ends in a 'Z', and
|
||||
* formating DateMath expressions using 3 decimals of milliseconds) while
|
||||
* still supporting some newer functionality of DateField (ie: DateMath on
|
||||
* explicit strings in addition to "NOW")
|
||||
* </p>
|
||||
* <p>
|
||||
* Users that desire 100% backwards compatibility should consider using
|
||||
* the Solr 1.2 version of <tt>DateField</tt>
|
||||
* </p>
|
||||
*
|
||||
* @see <a href="https://issues.apache.org/jira/browse/SOLR-552">SOLR-552</a>
|
||||
* @see <a href="https://issues.apache.org/jira/browse/SOLR-470">SOLR-470</a>
|
||||
* @see <a href="https://issues.apache.org/jira/browse/SOLR-521">SOLR-521</a>
|
||||
* @deprecated use {@link DateField}
|
||||
*/
|
||||
@Deprecated
|
||||
public final class LegacyDateField extends DateField {
|
||||
|
||||
/**
|
||||
* Overrides the super class to short circut and do no enforcing of
|
||||
* the canonical format
|
||||
*/
|
||||
public String toInternal(String val) {
|
||||
final int len=val.length();
|
||||
if (val.charAt(len-1) == Z) {
|
||||
// check common case first, simple datetime
|
||||
// NOTE: not parsed to ensure correctness
|
||||
return val.substring(0,len-1);
|
||||
}
|
||||
return toInternal(parseMath(null, val));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a DateFormat which does <b>NOT</b> respect the
|
||||
* ISO 8601 canonical format with regards to trailing zeros in milliseconds,
|
||||
* instead if always formats milliseconds to 3 decimal points.
|
||||
*/
|
||||
protected DateFormat getThreadLocalDateFormat() {
|
||||
return fmtThreadLocal.get();
|
||||
}
|
||||
|
||||
protected String formatDate(Date d) {
|
||||
return getThreadLocalDateFormat().format(d);
|
||||
}
|
||||
|
||||
private static ThreadLocalDateFormat fmtThreadLocal
|
||||
= new ThreadLocalDateFormat();
|
||||
|
||||
private static class ThreadLocalDateFormat extends ThreadLocal<DateFormat> {
|
||||
DateFormat proto;
|
||||
public ThreadLocalDateFormat() {
|
||||
super();
|
||||
SimpleDateFormat tmp =
|
||||
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US);
|
||||
tmp.setTimeZone(UTC);
|
||||
proto = tmp;
|
||||
}
|
||||
|
||||
protected DateFormat initialValue() {
|
||||
return (DateFormat) proto.clone();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -22,10 +22,92 @@ import org.apache.solr.request.SolrQueryRequest;
|
|||
|
||||
/**
|
||||
* Create a dismax query from the input value.
|
||||
* <br>Other parameters: all main query related parameters from the {@link org.apache.solr.handler.DisMaxRequestHandler} are supported.
|
||||
* localParams are checked before global request params.
|
||||
* <br>localParams are checked before global request params.
|
||||
* <br>Example: <code>{!dismax qf='myfield mytitle^2'}foo</code> creates a dismax query across
|
||||
* across myfield and mytitle, with a higher weight on mytitle.
|
||||
*
|
||||
* <p>
|
||||
* A Generic query plugin designed to be given a simple query expression
|
||||
* from a user, which it will then query against a variety of
|
||||
* pre-configured fields, in a variety of ways, using BooleanQueries,
|
||||
* DisjunctionMaxQueries, and PhraseQueries.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* All of the following options may be configured for this plugin
|
||||
* in the solrconfig as defaults, and may be overriden as request parameters
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>q.alt - An alternate query to be used in cases where the main
|
||||
* query (q) is not specified (or blank). This query should
|
||||
* be expressed in the Standard SolrQueryParser syntax (you
|
||||
* can use <code>q.alt=*:*</code> to denote that all documents
|
||||
* should be returned when no query is specified)
|
||||
* </li>
|
||||
* <li>tie - (Tie breaker) float value to use as tiebreaker in
|
||||
* DisjunctionMaxQueries (should be something much less than 1)
|
||||
* </li>
|
||||
* <li> qf - (Query Fields) fields and boosts to use when building
|
||||
* DisjunctionMaxQueries from the users query. Format is:
|
||||
* "<code>fieldA^1.0 fieldB^2.2</code>".
|
||||
* This param can be specified multiple times, and the fields
|
||||
* are additive.
|
||||
* </li>
|
||||
* <li> mm - (Minimum Match) this supports a wide variety of
|
||||
* complex expressions.
|
||||
* read {@link org.apache.solr.util.SolrPluginUtils#setMinShouldMatch SolrPluginUtils.setMinShouldMatch} and <a href="http://lucene.apache.org/solr/api/org/apache/solr/util/doc-files/min-should-match.html">mm expression format</a> for details.
|
||||
* </li>
|
||||
* <li> pf - (Phrase Fields) fields/boosts to make phrase queries out
|
||||
* of, to boost the users query for exact matches on the specified fields.
|
||||
* Format is: "<code>fieldA^1.0 fieldB^2.2</code>".
|
||||
* This param can be specified multiple times, and the fields
|
||||
* are additive.
|
||||
* </li>
|
||||
* <li> ps - (Phrase Slop) amount of slop on phrase queries built for pf
|
||||
* fields.
|
||||
* </li>
|
||||
* <li> qs - (Query Slop) amount of slop on phrase queries explicitly
|
||||
* specified in the "q" for qf fields.
|
||||
* </li>
|
||||
* <li> bq - (Boost Query) a raw lucene query that will be included in the
|
||||
* users query to influence the score. If this is a BooleanQuery
|
||||
* with a default boost (1.0f), then the individual clauses will be
|
||||
* added directly to the main query. Otherwise, the query will be
|
||||
* included as is.
|
||||
* This param can be specified multiple times, and the boosts are
|
||||
* are additive. NOTE: the behaviour listed above is only in effect
|
||||
* if a single <code>bq</code> paramter is specified. Hence you can
|
||||
* disable it by specifying an additional, blank, <code>bq</code>
|
||||
* parameter.
|
||||
* </li>
|
||||
* <li> bf - (Boost Functions) functions (with optional boosts) that will be
|
||||
* included in the users query to influence the score.
|
||||
* Format is: "<code>funcA(arg1,arg2)^1.2
|
||||
* funcB(arg3,arg4)^2.2</code>". NOTE: Whitespace is not allowed
|
||||
* in the function arguments.
|
||||
* This param can be specified multiple times, and the functions
|
||||
* are additive.
|
||||
* </li>
|
||||
* <li> fq - (Filter Query) a raw lucene query that can be used
|
||||
* to restrict the super set of products we are interested in - more
|
||||
* efficient then using bq, but doesn't influence score.
|
||||
* This param can be specified multiple times, and the filters
|
||||
* are additive.
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>
|
||||
* The following options are only available as request params...
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li> q - (Query) the raw unparsed, unescaped, query from the user.
|
||||
* </li>
|
||||
* <li>sort - (Order By) list of fields and direction to sort on.
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
*/
|
||||
public class DisMaxQParserPlugin extends QParserPlugin {
|
||||
public static String NAME = "dismax";
|
||||
|
|
|
@ -614,7 +614,7 @@ class DateValueSourceParser extends ValueSourceParser {
|
|||
public ValueSource getValueSource(FunctionQParser fp, String arg) {
|
||||
if (arg == null) return null;
|
||||
SchemaField f = fp.req.getSchema().getField(arg);
|
||||
if (f.getType().getClass() == DateField.class || f.getType().getClass() == LegacyDateField.class) {
|
||||
if (f.getType().getClass() == DateField.class) {
|
||||
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Can't use ms() function on non-numeric legacy date field " + arg);
|
||||
}
|
||||
return f.getType().getValueSource(f, fp);
|
||||
|
|
|
@ -197,18 +197,6 @@ public class DisMaxRequestHandlerTest extends SolrTestCaseJ4 {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOldStyleDefaults() throws Exception {
|
||||
|
||||
lrf = h.getRequestFactory
|
||||
("dismaxOldStyleDefaults", 0, 20,
|
||||
"version","2.0",
|
||||
"facet", "true",
|
||||
"facet.field","t_s"
|
||||
);
|
||||
doTestSomeStuff("dismaxOldStyleDefaults");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimplestParams() throws Exception {
|
||||
|
||||
|
|
|
@ -20,10 +20,8 @@ package org.apache.solr;
|
|||
|
||||
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.util._TestUtil;
|
||||
import org.apache.noggit.CharArr;
|
||||
import org.apache.noggit.JSONUtil;
|
||||
import org.apache.noggit.JSONWriter;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.apache.solr.common.SolrInputField;
|
||||
|
@ -33,18 +31,13 @@ import org.apache.solr.common.util.XML;
|
|||
import org.apache.solr.core.SolrConfig;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.handler.JsonUpdateRequestHandler;
|
||||
import org.apache.solr.handler.RequestHandlerBase;
|
||||
import org.apache.solr.request.BinaryQueryResponseWriter;
|
||||
import org.apache.solr.request.LocalSolrQueryRequest;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.request.SolrRequestHandler;
|
||||
import org.apache.solr.response.QueryResponseWriter;
|
||||
import org.apache.solr.response.SolrQueryResponse;
|
||||
import org.apache.solr.schema.IndexSchema;
|
||||
import org.apache.solr.schema.SchemaField;
|
||||
import org.apache.solr.search.SolrIndexSearcher;
|
||||
import org.apache.solr.servlet.DirectSolrConnection;
|
||||
import org.apache.solr.servlet.SolrRequestParsers;
|
||||
import org.apache.solr.util.TestHarness;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -55,7 +48,6 @@ import org.xml.sax.SAXException;
|
|||
import javax.xml.xpath.XPathExpressionException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TestFastInputStream extends LuceneTestCase {
|
|||
String ss = "Helloooooooooooooooooooo";
|
||||
writeChars(gzos, ss, 0, ss.length());
|
||||
gzos.close();
|
||||
NamedListCodec.writeVInt(10, fos);
|
||||
JavaBinCodec.writeVInt(10, fos);
|
||||
fos.flushBuffer();
|
||||
GZIPInputStream gzis = new GZIPInputStream(new ByteArrayInputStream(b.toByteArray(), 0, b.size()));
|
||||
char[] cbuf = new char[ss.length()];
|
||||
|
|
|
@ -32,7 +32,7 @@ public class TestPropInject extends AbstractSolrTestCase {
|
|||
ExposeWriterHandler uh = new ExposeWriterHandler();
|
||||
IndexWriter writer = uh.getWriter();
|
||||
LogByteSizeMergePolicy mp = (LogByteSizeMergePolicy)writer.getConfig().getMergePolicy();
|
||||
assertEquals(64.0, mp.getMaxMergeMB());
|
||||
assertEquals(64.0, mp.getMaxMergeMB(), 0);
|
||||
uh.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class TestPropInjectDefaults extends SolrTestCaseJ4 {
|
|||
ExposeWriterHandler uh = new ExposeWriterHandler();
|
||||
IndexWriter writer = uh.getWriter();
|
||||
LogByteSizeMergePolicy mp = (LogByteSizeMergePolicy)writer.getConfig().getMergePolicy();
|
||||
assertEquals(32.0, mp.getMaxMergeMB());
|
||||
assertEquals(32.0, mp.getMaxMergeMB(), 0);
|
||||
uh.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
package org.apache.solr.handler;
|
||||
|
||||
/**
|
||||
* Copyright 2004 The Apache Software Foundation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.util.AbstractSolrTestCase;
|
||||
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import java.io.StringReader;
|
||||
|
||||
public class AnalysisRequestHandlerTest extends AbstractSolrTestCase {
|
||||
private XMLInputFactory inputFactory = XMLInputFactory.newInstance();
|
||||
|
||||
@Override
|
||||
public String getSchemaFile() {
|
||||
return "schema.xml";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSolrConfigFile() {
|
||||
return "solrconfig.xml";
|
||||
}
|
||||
|
||||
|
||||
public void testReadDoc() throws Exception {
|
||||
String xml =
|
||||
"<docs><doc >" +
|
||||
" <field name=\"id\" >12345</field>" +
|
||||
" <field name=\"name\">cute little kitten</field>" +
|
||||
" <field name=\"text\">the quick red fox jumped over the lazy brown dogs</field>" +
|
||||
"</doc>" +
|
||||
"<doc >" +
|
||||
" <field name=\"id\" >12346</field>" +
|
||||
" <field name=\"name\">big mean dog</field>" +
|
||||
" <field name=\"text\">cats like to purr</field>" +
|
||||
"</doc>" +
|
||||
"</docs>";
|
||||
|
||||
XMLStreamReader parser =
|
||||
inputFactory.createXMLStreamReader(new StringReader(xml));
|
||||
AnalysisRequestHandler handler = new AnalysisRequestHandler();
|
||||
NamedList<Object> result = handler.processContent(parser, h.getCore().getSchema());
|
||||
assertTrue("result is null and it shouldn't be", result != null);
|
||||
NamedList<NamedList<NamedList<Object>>> theTokens = (NamedList<NamedList<NamedList<Object>>>) result.get("12345");
|
||||
assertTrue("theTokens is null and it shouldn't be", theTokens != null);
|
||||
NamedList<NamedList<Object>> tokens = theTokens.get("name");
|
||||
assertTrue("tokens is null and it shouldn't be", tokens != null);
|
||||
assertTrue("tokens Size: " + tokens.size() + " is not : " + 3, tokens.size() == 3);
|
||||
NamedList<Object> token;
|
||||
String value;
|
||||
token = tokens.get("token", 0);
|
||||
value = (String) token.get("value");
|
||||
assertTrue(value + " is not equal to " + "cute", value.equals("cute") == true);
|
||||
token = tokens.get("token", 1);
|
||||
value = (String) token.get("value");
|
||||
assertTrue(value + " is not equal to " + "little", value.equals("little") == true);
|
||||
|
||||
token = tokens.get("token", 2);
|
||||
value = (String) token.get("value");
|
||||
assertTrue(value + " is not equal to " + "kitten", value.equals("kitten") == true);
|
||||
|
||||
tokens = theTokens.get("text");
|
||||
assertTrue("tokens is null and it shouldn't be", tokens != null);
|
||||
assertTrue("tokens Size: " + tokens.size() + " is not : " + 8, tokens.size() == 8);//stopwords are removed
|
||||
|
||||
String[] gold = new String[]{"quick", "red", "fox", "jump", "over", "lazi", "brown", "dog"};
|
||||
for (int j = 0; j < gold.length; j++) {
|
||||
NamedList<Object> tok = tokens.get("token", j);
|
||||
value = (String) tok.get("value");
|
||||
assertTrue(value + " is not equal to " + gold[j], value.equals(gold[j]) == true);
|
||||
}
|
||||
theTokens = (NamedList<NamedList<NamedList<Object>>>) result.get("12346");
|
||||
assertTrue("theTokens is null and it shouldn't be", theTokens != null);
|
||||
tokens = theTokens.get("name");
|
||||
assertTrue("tokens is null and it shouldn't be", tokens != null);
|
||||
assertTrue("tokens Size: " + tokens.size() + " is not : " + 3, tokens.size() == 3);
|
||||
gold = new String[]{"cat", "like", "purr"};
|
||||
tokens = theTokens.get("text");
|
||||
assertTrue("tokens is null and it shouldn't be", tokens != null);
|
||||
assertTrue("tokens Size: " + tokens.size() + " is not : " + 3, tokens.size() == 3);//stopwords are removed
|
||||
for (int j = 0; j < gold.length; j++) {
|
||||
NamedList<Object> tok = tokens.get("token", j);
|
||||
value = (String) tok.get("value");
|
||||
assertTrue(value + " is not equal to " + gold[j], value.equals(gold[j]) == true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.apache.solr.schema;
|
||||
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.solr.schema.DateField;
|
||||
import org.apache.solr.util.DateMathParser;
|
||||
import org.apache.lucene.document.Fieldable;
|
||||
|
@ -28,13 +29,24 @@ import java.text.DateFormat;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class DateFieldTest extends LegacyDateFieldTest {
|
||||
|
||||
public class DateFieldTest extends LuceneTestCase {
|
||||
public static TimeZone UTC = TimeZone.getTimeZone("UTC");
|
||||
protected DateField f = null;
|
||||
protected DateMathParser p = new DateMathParser(UTC, Locale.US);
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
f = new DateField();
|
||||
}
|
||||
|
||||
public void assertToI(String expected, String input) {
|
||||
assertEquals("Input: " + input, expected, f.toInternal(input));
|
||||
}
|
||||
|
||||
public void assertToI(String expected, long input) {
|
||||
assertEquals("Input: " + input, expected, f.toInternal(new Date(input)));
|
||||
}
|
||||
|
||||
public void testToInternal() throws Exception {
|
||||
assertToI("1995-12-31T23:59:59.999", "1995-12-31T23:59:59.999666Z");
|
||||
assertToI("1995-12-31T23:59:59.999", "1995-12-31T23:59:59.999Z");
|
||||
|
|
|
@ -1,101 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.apache.solr.schema;
|
||||
|
||||
import org.apache.solr.schema.DateField;
|
||||
import org.apache.solr.util.DateMathParser;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import java.util.Locale;
|
||||
|
||||
public class LegacyDateFieldTest extends LuceneTestCase {
|
||||
// if and when this class is removed, make sure to refactor all
|
||||
// appropriate code to DateFieldTest
|
||||
|
||||
public static TimeZone UTC = TimeZone.getTimeZone("UTC");
|
||||
protected DateField f = null;
|
||||
protected DateMathParser p = null;
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
p = new DateMathParser(UTC, Locale.US);
|
||||
f = new DateField();
|
||||
// so test can be run against Solr 1.2...
|
||||
try {
|
||||
Class clazz = Class.forName("org.apache.solr.schema.LegacyDateField");
|
||||
f = (DateField) clazz.newInstance();
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
// NOOP
|
||||
}
|
||||
}
|
||||
|
||||
public void assertToI(String expected, String input) {
|
||||
assertEquals("Input: " + input, expected, f.toInternal(input));
|
||||
}
|
||||
|
||||
public void testToInternal() throws Exception {
|
||||
assertToI("1995-12-31T23:59:59.999", "1995-12-31T23:59:59.999Z");
|
||||
assertToI("1995-12-31T23:59:59.99", "1995-12-31T23:59:59.99Z");
|
||||
assertToI("1995-12-31T23:59:59.9", "1995-12-31T23:59:59.9Z");
|
||||
assertToI("1995-12-31T23:59:59", "1995-12-31T23:59:59Z");
|
||||
|
||||
// this is the broken behavior
|
||||
assertToI("1995-12-31T23:59:59.9998", "1995-12-31T23:59:59.9998Z");
|
||||
assertToI("1995-12-31T23:59:59.9990", "1995-12-31T23:59:59.9990Z");
|
||||
assertToI("1995-12-31T23:59:59.990", "1995-12-31T23:59:59.990Z");
|
||||
assertToI("1995-12-31T23:59:59.900", "1995-12-31T23:59:59.900Z");
|
||||
assertToI("1995-12-31T23:59:59.90", "1995-12-31T23:59:59.90Z");
|
||||
assertToI("1995-12-31T23:59:59.000", "1995-12-31T23:59:59.000Z");
|
||||
assertToI("1995-12-31T23:59:59.00", "1995-12-31T23:59:59.00Z");
|
||||
assertToI("1995-12-31T23:59:59.0", "1995-12-31T23:59:59.0Z");
|
||||
|
||||
}
|
||||
|
||||
public void assertToI(String expected, long input) {
|
||||
assertEquals("Input: " + input, expected, f.toInternal(new Date(input)));
|
||||
}
|
||||
|
||||
public void testToInternalObj() throws Exception {
|
||||
assertToI("1995-12-31T23:59:59.999", 820454399999l);
|
||||
|
||||
// this is the broken behavior
|
||||
assertToI("1995-12-31T23:59:59.990", 820454399990l);
|
||||
assertToI("1995-12-31T23:59:59.900", 820454399900l);
|
||||
assertToI("1995-12-31T23:59:59.000", 820454399000l);
|
||||
}
|
||||
|
||||
public void assertItoR(String expected, String input) {
|
||||
assertEquals("Input: " + input, expected, f.indexedToReadable(input));
|
||||
}
|
||||
|
||||
public void testIndexedToReadable() {
|
||||
assertItoR("1995-12-31T23:59:59.999Z", "1995-12-31T23:59:59.999");
|
||||
assertItoR("1995-12-31T23:59:59.99Z", "1995-12-31T23:59:59.99");
|
||||
assertItoR("1995-12-31T23:59:59.9Z", "1995-12-31T23:59:59.9");
|
||||
assertItoR("1995-12-31T23:59:59Z", "1995-12-31T23:59:59");
|
||||
}
|
||||
public void testFormatter() {
|
||||
assertEquals("1970-01-01T00:00:00.005", f.formatDate(new Date(5)));
|
||||
// all of this is broken behavior
|
||||
assertEquals("1970-01-01T00:00:00.000", f.formatDate(new Date(0)));
|
||||
assertEquals("1970-01-01T00:00:00.370", f.formatDate(new Date(370)));
|
||||
assertEquals("1970-01-01T00:00:00.900", f.formatDate(new Date(900)));
|
||||
}
|
||||
}
|
|
@ -251,30 +251,10 @@
|
|||
<requestHandler name="standard" class="solr.StandardRequestHandler">
|
||||
<bool name="httpCaching">true</bool>
|
||||
</requestHandler>
|
||||
<requestHandler name="dismaxOldStyleDefaults"
|
||||
class="solr.DisMaxRequestHandler" >
|
||||
<!-- for historic reasons, DisMaxRequestHandler will use all of
|
||||
it's init params as "defaults" if there is no "defaults" list
|
||||
specified
|
||||
-->
|
||||
<str name="q.alt">*:*</str>
|
||||
<float name="tie">0.01</float>
|
||||
<str name="qf">
|
||||
text^0.5 features_t^1.0 subject^1.4 title_stemmed^2.0
|
||||
</str>
|
||||
<str name="pf">
|
||||
text^0.2 features_t^1.1 subject^1.4 title_stemmed^2.0 title^1.5
|
||||
</str>
|
||||
<str name="bf">
|
||||
ord(weight)^0.5 recip(rord(iind),1,1000,1000)^0.3
|
||||
</str>
|
||||
<str name="mm">
|
||||
3<-1 5<-2 6<90%
|
||||
</str>
|
||||
<int name="ps">100</int>
|
||||
</requestHandler>
|
||||
<requestHandler name="dismax" class="solr.DisMaxRequestHandler" >
|
||||
|
||||
<requestHandler name="dismax" class="solr.SearchHandler" >
|
||||
<lst name="defaults">
|
||||
<str name="defType">dismax</str>
|
||||
<str name="q.alt">*:*</str>
|
||||
<float name="tie">0.01</float>
|
||||
<str name="qf">
|
||||
|
@ -292,8 +272,13 @@
|
|||
<int name="ps">100</int>
|
||||
</lst>
|
||||
</requestHandler>
|
||||
<requestHandler name="dismaxNoDefaults" class="solr.DisMaxRequestHandler" >
|
||||
</requestHandler>
|
||||
|
||||
<requestHandler name="dismaxNoDefaults" class="solr.SearchHandler" >
|
||||
<lst name="defaults">
|
||||
<str name="defType">dismax</str>
|
||||
</lst>
|
||||
</requestHandler>
|
||||
|
||||
<requestHandler name="old" class="solr.tst.OldRequestHandler" >
|
||||
<int name="myparam">1000</int>
|
||||
<float name="ratio">1.4142135</float>
|
||||
|
|
Loading…
Reference in New Issue