Albert Casademont created SOLR-6970:
---------------------------------------

             Summary: ManagedResource PUT and POST should behave differently
                 Key: SOLR-6970
                 URL: https://issues.apache.org/jira/browse/SOLR-6970
             Project: Solr
          Issue Type: Improvement
          Components: Schema and Analysis
    Affects Versions: 4.10.3
            Reporter: Albert Casademont


We are testing the new ManagedResource for managing our Synonym filter and 
although it works pretty well we find it quite difficult to manage the list 
using the API. Specially there is no difference in using POST and PUT verbs and 
IMHO they should behave slightly different. Let me explain.

We start with an empty synonyms list, and we push the first synonym

{code}
curl -X PUT -H 'Content-type:application/json' --data-binary 
'{"mad":["angry","upset", "error"]}' 
"http://localhost:8983/solr/techproducts/schema/analysis/synonyms/english";
{code}

Everyting works ok! Now I realise I made a mistake and one of the synonyms is 
incorrect. My instinct says that if i PUT the correct list again it will be 
overwritten.

{code}
curl -X PUT -H 'Content-type:application/json' --data-binary 
'{"mad":["angry","upset"]}' 
"http://localhost:8983/solr/techproducts/schema/analysis/synonyms/english";
{code}

But here nothing happens, the list stays the same wit the "error" synonym still 
in it. I have to DELETE thelist for the "mad" key and PUT it again.

{code}
curl -X DELETE  
"http://localhost:8983/solr/techproducts/schema/analysis/synonyms/english/mad";
curl -X PUT -H 'Content-type:application/json' --data-binary 
'{"mad":["angry","upset"]}' 
"http://localhost:8983/solr/techproducts/schema/analysis/synonyms/english";
{code}

My proposal is that a PUT command should replace the list entirely, no matter 
what was in the list (which in turn should be more performant, as it would not 
need to iterate the whole list looking for additions to be made). A POST 
command should work like it is working now, where only the additions are 
processed.

That would also enable to submit a whole list using PUT. Right now if you want 
to replace all the synonyms you have to delete them one by one and then 
POST/PUT the entire list. With this modification you would PUT the whole list 
and it would be replaced.

I am not quite familiar with the Solr java code but I guess I should be able to 
submit a patch If the issue is considered.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to