[
https://issues.apache.org/jira/browse/SOLR-7697?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Steve Rowe updated SOLR-7697:
-----------------------------
Attachment: SOLR-7697.patch
Thanks Marius.
I'm attaching a modified patch:
# Specifying an analyzer class on a field type is mutually exclusive of
specification of char filters, a tokenizer, and filters - I modified
{{FieldTypeXmlAdaptor.createAnalyzerElement()}} to throw exceptions for
requests that improperly mix these, and added a test confirming that to
{{TestBulkSchemaAPI}}.
# {{FieldType.getAnalyzerProperties()}} wasn't outputting
{{luceneMatchVersion}}, so although field type addition/modification was
properly accepting specification of {{luceneMatchVersion}} when an analyzer
class was specified, serialization wasn't preserving the information. I fixed
it, and added a test that the round-tripping works to {{TestBulkSchemaAPI}}.
# Your patch moved some imports around in {{FieldTypeXmlAdaptor}} but didn't
otherwise change them. In general, don't reorder imports unless they're
completely unordered or you change them significantly. You may have to change
a setting in your IDE to address this. (I put them back in my patch.)
I think it's ready to go - I'll commit shortly.
> Schema API doesn't take class or luceneMatchVersion attributes into account
> for the analyzer when adding a new field type
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: SOLR-7697
> URL: https://issues.apache.org/jira/browse/SOLR-7697
> Project: Solr
> Issue Type: Bug
> Components: Schema and Analysis
> Affects Versions: 5.2
> Reporter: Marius Grama
> Assignee: Steve Rowe
> Priority: Minor
> Fix For: 5.3, Trunk
>
> Attachments: SOLR-7697.patch, SOLR-7697.patch
>
>
> I've noticed that in schema.xml can be defined field types like the following
> :
> {code}
> <fieldType name="nametext" class="solr.TextField">
> <analyzer class="org.apache.lucene.analysis.core.WhitespaceAnalyzer"/>
> </fieldType>
> {code}
> The current add-field-type update operation from Schema API doesn't take into
> account the class (and the luceneMatchVersion - see
> FieldTypePluginLoader.java) for the field type analyzer definition, but only
> their type.
> See FieldTypeXmlAdapter.java
> {code}
> protected static Element createAnalyzerElement(Document doc, String type,
> Map<String,?> json) {
> Element analyzer = doc.createElement("analyzer");
> if (type != null)
> analyzer.setAttribute("type", type);
> .....
> {code}
> If the change would be made, the add-field-type request would look like this :
> {code}
> curl -X POST -H 'Content-type:application/json' --data-binary '{
> "add-field-type": {
> "name": "nametext",
> "class": "solr.TextField",
> "analyzer": {
> "class": "org.apache.lucene.analysis.core.WhitespaceAnalyzer"
> }
> }
> }' http://localhost:8983/solr/gettingstarted/schema
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]