[ 
https://issues.apache.org/jira/browse/SOLR-5655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13898360#comment-13898360
 ] 

Timothy Potter commented on SOLR-5655:
--------------------------------------

Should have provided some details about the API ...

To activate, you would need to declare a filter in schema.xml as:

    <fieldType name="managed_en" class="solr.TextField" 
positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter 
class="org.apache.solr.rest.schema.analysis.ManagedStopFilterFactory" 
managed="english" />
      </analyzer>
    </fieldType>

To see the list of managed stopwords for the "english" handle:

curl -i -v 
"http://localhost:8984/solr/<collection|core>/schema/analysis/stopwords/english"

This would return a JSON object/map that looks like:

{
  "initArgs":{"ignoreCase":"true"},
  "initializedOn":"2014-02-10T16:23:55.247Z",
  "managedList":[
    "a",
    "an",
    "and",
    "are",
    "as", … ] }

To add some stop words to the set, you'd do:

curl -v -X PUT \
  -H 'Content-type:application/json' \
  --data-binary '["foo"]' \
  
'http://localhost:8984/solr/<collection|core>/schema/analysis/stopwords/english'

You can also just get a single word, which will raise a 404 if it is not in the 
set:

curl -i -v 
"http://localhost:8984/solr/<collection|core>/schema/analysis/stopwords/english/the"

Lastly, just to be clear, none of the changes made by the API will be "applied" 
to the underlying analysis components (in this case the StopFilter) until the 
core is reloaded.



> Create a stopword filter factory that is (re)configurable, and capable of 
> reporting its configuration, via REST API
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-5655
>                 URL: https://issues.apache.org/jira/browse/SOLR-5655
>             Project: Solr
>          Issue Type: Sub-task
>          Components: Schema and Analysis
>            Reporter: Steve Rowe
>         Attachments: SOLR-5655.patch
>
>
> A stopword 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 stopwords resource file.
> Read-only (GET) REST API calls should also be provided, both for init params 
> and the stopwords resource file.
> It should be possible to add/remove one or more entries in the stopwords 
> 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]

Reply via email to