[
https://issues.apache.org/jira/browse/SOLR-5654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13900570#comment-13900570
]
Timothy Potter commented on SOLR-5654:
--------------------------------------
Thanks Yonik. Here are some examples:
In schema.xml, you'd activate this using something like:
<fieldType name="managed_en" class="solr.TextField"
positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter
class="org.apache.solr.rest.schema.analysis.ManagedSynonymFilterFactory"
managed="english" />
</analyzer>
</fieldType>
GET a list of managed synonym mappings for managed handle "english" using:
curl -i -v
"http://localhost:8984/solr/<collection>/schema/analysis/synonyms/english"
This would return a JSON structure that looks like (which is pretty much the
same as the JSON backed storage structure):
{
"initArgs": {
"ignoreCase":"true",
"format":"solr"
},
"managedMap": {
"GB":[ "GiB", "Gigabyte"],
"TV":["Television"],
"happy":[ "glad", "joyful"]
}
}
btw ... I'm not in love the with managedMap or managedList thing so am open to
suggestions. My thinking there was that the property name gave some hint as to
what the type of data structure the value is.
PUT: Add a mapping using PUT/POST
curl -v -X PUT \
-H 'Content-type:application/json' \
--data-binary '{"sad":["unhappy"]}' \
'http://localhost:8984/solr/<collection>/schema/analysis/synonyms/english'
There's some question in my mind if PUT should merge in new values to the
existing synonym mappings or replace them. I chose to merge in, which puts a
burden on the client to DELETE (not yet working) synonym mappings they don't
want to keep around. In other words, there's no way to wholesale replace the
existing mappings with another set, but that seems more like how users will use
the feature, ie. adding a synonym here and there as needs evolve.
You can also GET a specific mapping (or 404 if one doesn't exist) using:
curl -i -v
"http://localhost:8984/solr/<collection>/schema/analysis/synonyms/english/happy"
<-- would return { "happy":["glad"], ... }
curl -i -v
"http://localhost:8984/solr/<collection>/schema/analysis/synonyms/english/yappy"
<-- would return 404
Lastly, I'm planning to support a GET request to get all known handles:
curl -i -v "http://localhost:8984/solr/<collection>/schema/analysis/synonyms"
Currently would return a JSON list of known managed synonym mappings: [ {
"english": { some stats / metadata here, such as whether it is 'dirty' } ]
> Create a synonym filter factory that is (re)configurable, and capable of
> reporting its configuration, via REST API
> ------------------------------------------------------------------------------------------------------------------
>
> Key: SOLR-5654
> URL: https://issues.apache.org/jira/browse/SOLR-5654
> Project: Solr
> Issue Type: Sub-task
> Components: Schema and Analysis
> Reporter: Steve Rowe
> Attachments: SOLR-5654.patch
>
>
> A synonym filter factory could be (re)configurable via REST API by
> registering with the RESTManager described in SOLR-5653, and then responding
> to REST API calls to modify its init params and its synonyms resource file.
> Read-only (GET) REST API calls should also be provided, both for init params
> and the synonyms resource file.
> It should be possible to add/remove/modify one or more entries in the
> synonyms resource file.
> We should probably use JSON for the REST request body, as is done in the
> Schema REST API methods.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]