[
https://issues.apache.org/jira/browse/SOLR-4623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13614669#comment-13614669
]
Steve Rowe commented on SOLR-4623:
----------------------------------
Robert's comment from the mailing list - I'll commit the patch shortly, as I
agree about the bugs it fixes - thanks Robert:
{quote}
Well there are several bugs, resulting from the over-aggressive
normalization combined with normalizing *always* despite this comment:
// Only normalize factory names
So consider the case someone has
<similarity class="org.apache.lucene.search.similarities.BM25Similarity"/>
which is allowed (it uses the anonymous factory). In this case its
bogusly normalized to "solr.BM25Similarity" which is invalid and won't
be loaded by IndexSchema, since it only looks for solr.xxxx in
org.apache.solr.search.similarities.
I think a patch like the following is a good start, but we should
review the other uses of the same code-dup'ed function in IndexSchema
and ensure there are not similar bugs:
I'm sorry if i came off terse or as a haiku, its not a big deal, I
just want it to work correctly.
{noformat}
Index: solr/core/src/java/org/apache/solr/schema/SimilarityFactory.java
===================================================================
--- solr/core/src/java/org/apache/solr/schema/SimilarityFactory.java
(revision 1460952)
+++ solr/core/src/java/org/apache/solr/schema/SimilarityFactory.java
(working copy)
@@ -51,9 +51,9 @@
public abstract Similarity getSimilarity();
- private static String normalizeSPIname(String fullyQualifiedName) {
- if (fullyQualifiedName.startsWith("org.apache.lucene.") ||
fullyQualifiedName.startsWith("org.apache.solr.")) {
- return "solr" +
fullyQualifiedName.substring(fullyQualifiedName.lastIndexOf('.'));
+ private static String normalizeName(String fullyQualifiedName) {
+ if (fullyQualifiedName.startsWith("org.apache.solr.search.similarities."))
{
+ return "solr" +
fullyQualifiedName.substring("org.apache.solr.search.similarities".length());
}
return fullyQualifiedName;
}
@@ -66,10 +66,10 @@
className = getSimilarity().getClass().getName();
} else {
// Only normalize factory names
- className = normalizeSPIname(className);
+ className = normalizeName(className);
}
SimpleOrderedMap<Object> props = new SimpleOrderedMap<Object>();
- props.add(CLASS_NAME, normalizeSPIname(className));
+ props.add(CLASS_NAME, className);
if (null != params) {
Iterator<String> iter = params.getParameterNamesIterator();
while (iter.hasNext()) {
{noformat}
{quote}
> Add REST API methods to get all remaining schema information, and also to
> return the full live schema in json, xml, and schema.xml formats
> ------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: SOLR-4623
> URL: https://issues.apache.org/jira/browse/SOLR-4623
> Project: Solr
> Issue Type: Sub-task
> Components: Schema and Analysis
> Affects Versions: 4.2
> Reporter: Steve Rowe
> Assignee: Steve Rowe
> Priority: Minor
> Fix For: 4.3
>
> Attachments: JSONResponseWriter.output.json,
> SchemaXmlResponseWriter.output.xml, SOLR-4623.patch,
> XMLResponseWriter.output.xml
>
>
> Each remaining schema component (after field types, fields, dynamic fields,
> copy fields were added by SOLR-4503) should be available from the schema REST
> API: name, version, default query operator, similarity, default search field,
> and unique key.
> It should be possible to get the entire live schema back with a single
> request, and schema.xml format should be one of the supported response
> formats.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]