pysolr icon indicating copy to clipboard operation
pysolr copied to clipboard

add() should accept empty list

Open puzzlet opened this issue 5 years ago • 4 comments

I have

  • [x] Tested with the latest release
  • [x] Tested with the current master branch
  • [x] Searched for similar existing issues

Expected behaviour

solr_client.add([{'id': 'myid', 'multivalued_field_to_overwrite': ['value1'], 'multivalued_field_to_flush': []}], fieldUpdates={'multivalued_field_to_overwrite': 'set', 'multivalued_field_to_flush': 'set'}) should remove all the values of multivalued_field_to_flush.

Actual behaviour

multivalued_field_to_flush values are intact.

Steps to reproduce the behaviour

In [8]: solr_client.add([{'id': 'myid', 'multivalued_field_to_overwrite': ['value1'], 'multivalued_field_to_flush': []}], fieldUpdates={'multivalued_field_to_overwrite': 'set', 'multivalued_field_to_flush': 'set'})

Then Solr._build_doc() generates the HTML body like: <add><doc><field name="id">myid</field><field name="multivalued_field_to_overwrite">value1</field></doc></add>.

This body message should also include <field name="multivalued_field_to_flush"></field> to properly remove the values.

Configuration

  • Operating system version: Ubuntu 19.04
  • Search engine version: Solr 7.7.1
  • Python version: 3.7.3
  • pysolr version: 3.8.1

puzzlet avatar May 31 '19 08:05 puzzlet

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 29 '19 08:08 stale[bot]

This problem is also happening to us.

omllobet avatar Oct 30 '19 14:10 omllobet

It is always strange to see bots close issues based on inactivity. Just because no one has fixed the issue doesn't mean that the issue is gone.

bluenote10 avatar Nov 06 '19 12:11 bluenote10

@bluenote10 I agree, but we get a ton of issues which are due to local configuration or installation mistakes, misunderstandings, etc. and most of those never get updated by the original reporter. You can re-open an issue at any time if it's still relevant and you're planning to work on it.

acdha avatar Nov 06 '19 14:11 acdha