[
https://issues.apache.org/jira/browse/SOLR-7679?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Steve Rowe updated SOLR-7679:
-----------------------------
Attachment: SOLR-7679.patch
Thanks Marius.
I'm attaching a modified patch:
You switched {{TestBulkSchemaAPI}} to using the to-be-deprecated (SOLR-6594)
non-bulk API, via extra servlet setup in {{before()}}, AFAICT so that you could
get the {{showDefaults}} behavior, which is not available with the bulk Schema
API. But this is a bug in {{FieldType.getNamedPropertyValues()}}: it only
outputs similarity when {{showDefaults=true}}, but it should instead always do
so. My version of the patch fixes this bug. (This is a round-tripping
problem: manual testing shows that when managed schema is persisted,
per-field-type similarity is currently dropped, which is bad.)
I was then able to revert {{TestBulkSchemaAPI}} to the previously used bulk
schema API, since {{showDefaults}} is no longer necessary to get the
per-field-type similarity to show up in the schema api response.
I think this is ready. I'll commit after running Solr tests and precommit.
In my testing I noticed that {{SchemaSimilarityFactory}}, a prerequisite for
setting per-field-type similarity, is not the default in any of Solr's example
schemas. See [http://markmail.org/message/7icpmwmdhfw4tmwv] and SOLR-3577 for
rationale.
We need to let people know that in order to set per-field-type similarity, they
need to first set the global similarity to {{SchemaSimilarityFactory}} or
something like it. Unfortunately the Schema API can't yet set the global
similarity - see SOLR-7242. I'll leave a comment there about the need to
check/update the Solr Reference Guide for this.
> Schema API doesn't take similarity attribute into account when adding field
> types
> ---------------------------------------------------------------------------------
>
> Key: SOLR-7679
> URL: https://issues.apache.org/jira/browse/SOLR-7679
> Project: Solr
> Issue Type: Bug
> Components: Schema and Analysis
> Affects Versions: 5.2
> Reporter: Marius Grama
> Priority: Minor
> Fix For: 5.3, Trunk
>
> Attachments: SOLR-7679.patch, SOLR-7679.patch, SOLR-7679.patch
>
>
> When using the request
> {code}
> curl -X POST -H 'Content-type:application/json' --data-binary '{
> "add-field-type": {
> "name": "fieldTypeWithSimilarity",
> "class": "org.apache.solr.schema.TextField",
> "analyzer": {
> "charFilters": [
> {
> "class": "solr.PatternReplaceCharFilterFactory",
> "replacement": "$1$1",
> "pattern": "([a-zA-Z])\\\\1+"
> }
> ],
> "tokenizer": {
> "class": "solr.WhitespaceTokenizerFactory"
> }
> },
> "similarity": {
> "class": "org.apache.lucene.misc.SweetSpotSimilarity"
> }
> }
> }' http://localhost:8983/solr/gettingstarted/schema
> {code}
> can be seen in the updated schema.xml that the similarity attributes for the
> newly added field type doesn't contain a _similarity_ entry.
> This is due to the fact that within FieldTypeXmlAdapter the similiarity
> element is not being added to the field type.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]