SOLR-10584: RefGuide updates, removal of some more dead code and a failing test

This commit is contained in:
Jan Høydahl 2017-05-15 15:59:11 +02:00
parent a1078143ed
commit 295602ce7b
7 changed files with 5 additions and 130 deletions

View File

@ -21,12 +21,12 @@ Schema defaults and `copyFields` cannot be used to populate the `uniqueKey` fiel
Further, the operation will fail if the `uniqueKey` field is used, but is multivalued (or inherits the multivalue-ness from the `fieldtype`). However, `uniqueKey` will continue to work, as long as the field is properly used.
[[OtherSchemaElements-DefaultSearchField_QueryOperator]]
== Default Search Field & Query Operator
[[OtherSchemaElements-DefaultSearchField]]
== Default Search Field
Although they have been deprecated for quite some time, Solr still has support for Schema based configuration of a `<defaultSearchField/>` (which is superseded by the <<the-standard-query-parser.adoc#the-standard-query-parser,`df parameter`>>) and `<solrQueryParser defaultOperator="OR"/>` (which is superseded by the <<the-standard-query-parser.adoc#the-standard-query-parser,`q.op` parameter>>.
Although it has been deprecated for quite some time, Solr still has support for Schema based configuration of a `<defaultSearchField/>` (which is superseded by the <<the-standard-query-parser.adoc#the-standard-query-parser,`df parameter`>>).
If you have these options specified in your Schema, you are strongly encouraged to replace them with request parameters (or <<request-parameters-api.adoc#request-parameters-api,request parameter defaults>>) as support for them may be removed from future Solr release.
If you have this option specified in your Schema, you are strongly encouraged to replace it with request parameters (or <<request-parameters-api.adoc#request-parameters-api,request parameter defaults>>) as support for it will be removed from future Solr release.
[[OtherSchemaElements-Similarity]]
== Similarity

View File

@ -47,7 +47,6 @@ bin/solr -e cloud -noprompt
* `/schema/version`: <<SchemaAPI-ShowtheSchemaVersion,retrieve>> the schema version
* `/schema/uniquekey`: <<SchemaAPI-ListUniqueKey,retrieve>> the defined uniqueKey
* `/schema/similarity`: <<SchemaAPI-ShowGlobalSimilarity,retrieve>> the global similarity definition
* `/schema/solrqueryparser/defaultoperator`: <<SchemaAPI-GettheDefaultQueryOperator,retrieve>> the default operator
[[SchemaAPI-ModifytheSchema]]
== Modify the Schema
@ -1165,63 +1164,6 @@ curl http://localhost:8983/solr/gettingstarted/schema/similarity?wt=json
----
[[SchemaAPI-GettheDefaultQueryOperator]]
=== Get the Default Query Operator
`GET /_collection_/schema/solrqueryparser/defaultoperator`
[[SchemaAPI-INPUT.9]]
==== INPUT
*Path Parameters*
// TODO: Change column width to %autowidth.spread when https://github.com/asciidoctor/asciidoctor-pdf/issues/599 is fixed
[cols="30,70",options="header"]
|===
|Key |Description
|collection |The collection (or core) name.
|===
*Query Parameters*
The query parameters can be added to the API request after a '?'.
// TODO: Change column width to %autowidth.spread when https://github.com/asciidoctor/asciidoctor-pdf/issues/599 is fixed
[cols="15,10,10,10,55",options="header"]
|===
|Key |Type |Required |Default |Description
|wt |string |No |json |Defines the format of the response. The options are *json* or *xml*. If not specified, JSON will be returned by default.
|===
[[SchemaAPI-OUTPUT.9]]
==== OUTPUT
*Output Content*
The output will include simply the default operator if none is defined by the user.
[[SchemaAPI-EXAMPLES.9]]
==== EXAMPLES
Get the default operator.
[source,bash]
----
curl http://localhost:8983/solr/gettingstarted/schema/solrqueryparser/defaultoperator?wt=json
----
[source,json]
----
{
"responseHeader":{
"status":0,
"QTime":2},
"defaultOperator":"OR"}
----
[[SchemaAPI-ManageResourceData]]
== Manage Resource Data

View File

@ -30,7 +30,7 @@ In addition to the common request parameter, highlighting parameters, and simple
|<<TheDisMaxQueryParser-TheqParameter,q>> |Defines the raw input strings for the query.
|<<TheDisMaxQueryParser-Theq.altParameter,q.alt>> |Calls the standard query parser and defines query input strings, when the q parameter is not used.
|<<TheDisMaxQueryParser-Theqf_QueryFields_Parameter,qf>> |Query Fields: specifies the fields in the index on which to perform the query. If absent, defaults to `df`.
|<<TheDisMaxQueryParser-Themm_MinimumShouldMatch_Parameter,mm>> |Minimum "Should" Match: specifies a minimum number of clauses that must match in a query. If no 'mm' parameter is specified in the query, or as a default in `solrconfig.xml`, the effective value of the `q.op` parameter (either in the query, as a default in `solrconfig.xml`, or from the `defaultOperator` option in the Schema) is used to influence the behavior. If `q.op` is effectively AND'ed, then mm=100%; if `q.op` is OR'ed, then mm=1. Users who want to force the legacy behavior should set a default value for the 'mm' parameter in their `solrconfig.xml` file. Users should add this as a configured default for their request handlers. This parameter tolerates miscellaneous white spaces in expressions (e.g., `" 3 < -25% 10 < -3\n", " \n-25%\n ", " \n3\n "`).
|<<TheDisMaxQueryParser-Themm_MinimumShouldMatch_Parameter,mm>> |Minimum "Should" Match: specifies a minimum number of clauses that must match in a query. If no 'mm' parameter is specified in the query, or as a default in `solrconfig.xml`, the effective value of the `q.op` parameter (either in the query or as a default in `solrconfig.xml`) is used to influence the behavior. If `q.op` is effectively AND'ed, then mm=100%; if `q.op` is OR'ed, then mm=1. Users who want to force the legacy behavior should set a default value for the 'mm' parameter in their `solrconfig.xml` file. Users should add this as a configured default for their request handlers. This parameter tolerates miscellaneous white spaces in expressions (e.g., `" 3 < -25% 10 < -3\n", " \n-25%\n ", " \n3\n "`).
|<<TheDisMaxQueryParser-Thepf_PhraseFields_Parameter,pf>> |Phrase Fields: boosts the score of documents in cases where all of the terms in the q parameter appear in close proximity.
|<<TheDisMaxQueryParser-Theps_PhraseSlop_Parameter,ps>> |Phrase Slop: specifies the number of positions two terms can be apart in order to match the specified phrase.
|<<TheDisMaxQueryParser-Theqs_QueryPhraseSlop_Parameter,qs>> |Query Phrase Slop: specifies the number of positions two terms can be apart in order to match the specified phrase. Used specifically with the `qf` parameter.

View File

@ -354,25 +354,6 @@ public class SchemaRequest extends AbstractSchemaRequest<SchemaResponse> {
}
}
/**
* Retrieves the default operator if it is defined in the schema.
*/
public static class DefaultQueryOperator extends AbstractSchemaRequest<SchemaResponse.DefaultQueryOperatorResponse> {
public DefaultQueryOperator() {
this(null);
}
public DefaultQueryOperator(SolrParams q) {
super(METHOD.GET, "/schema/solrqueryparser/defaultoperator", q);
}
@Override
protected SchemaResponse.DefaultQueryOperatorResponse createResponse(SolrClient client) {
return new SchemaResponse.DefaultQueryOperatorResponse();
}
}
/**
* Adds a new field definition to the schema.
* If the field already exists, the method {@link #process(SolrClient, String)} will fail.

View File

@ -31,8 +31,6 @@ public class SchemaRepresentation {
private String defaultSearchField;
private String defaultOperator;
private Map<String, Object> similarity;
private List<Map<String, Object>> fields;
@ -76,14 +74,6 @@ public class SchemaRepresentation {
this.defaultSearchField = defaultSearchField;
}
public String getDefaultOperator() {
return defaultOperator;
}
public void setDefaultOperator(String defaultOperator) {
this.defaultOperator = defaultOperator;
}
public Map<String, Object> getSimilarity() {
return similarity;
}

View File

@ -138,7 +138,6 @@ public class SchemaResponse extends SolrResponseBase {
schemaRepresentation.setVersion(getSchemaVersion(schemaObj));
schemaRepresentation.setUniqueKey(getSchemaUniqueKey(schemaObj));
schemaRepresentation.setDefaultSearchField(getDefaultSearchField(schemaObj));
schemaRepresentation.setDefaultOperator(getDefaultOperator(schemaObj));
schemaRepresentation.setSimilarity(getSimilarity(schemaObj));
schemaRepresentation.setFields(getFields(schemaObj));
schemaRepresentation.setDynamicFields(getDynamicFields(schemaObj));
@ -170,14 +169,6 @@ public class SchemaResponse extends SolrResponseBase {
return similarity;
}
@SuppressWarnings("unchecked")
private static String getDefaultOperator(Map schemaNamedList) {
String defaultOperator = null;
NamedList<Object> solrQueryParserProperties = (NamedList<Object>) schemaNamedList.get("solrQueryParser");
if (solrQueryParserProperties != null) defaultOperator = (String) solrQueryParserProperties.get("defaultOperator");
return defaultOperator;
}
@SuppressWarnings("unchecked")
private static List<Map<String, Object>> getFields(Map schemaNamedList) {
List<Map<String, Object>> fieldsAttributes = new LinkedList<>();
@ -416,25 +407,6 @@ public class SchemaResponse extends SolrResponseBase {
}
public static class DefaultQueryOperatorResponse extends SolrResponseBase {
private String defaultOperator;
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public void setResponse(NamedList<Object> response) {
super.setResponse(response);
defaultOperator = (String) response.get("defaultOperator");
}
public String getDefaultOperator() {
return defaultOperator;
}
}
public static class CopyFieldsResponse extends SolrResponseBase {
List<Map<String, Object>> copyFields;

View File

@ -242,16 +242,6 @@ public class SchemaTest extends RestTestBase {
globalSimilarityResponse.getSimilarity().get("class"));
}
@Test
public void testGetDefaultQueryOperatorAccuracy() throws Exception {
SchemaRequest.DefaultQueryOperator defaultQueryOperatorRequest =
new SchemaRequest.DefaultQueryOperator();
SchemaResponse.DefaultQueryOperatorResponse defaultQueryOperatorResponse =
defaultQueryOperatorRequest.process(getSolrClient());
assertValidSchemaResponse(defaultQueryOperatorResponse);
assertEquals("OR", defaultQueryOperatorResponse.getDefaultOperator());
}
@Test
public void testAddFieldAccuracy() throws Exception {
SchemaRequest.Fields fieldsSchemaRequest = new SchemaRequest.Fields();