Delete specific fields from a document
See original GitHub issueI have
- Tested with the latest release
- Tested with the current master branch
- Searched for similar existing issues
Expected behaviour
Solr allows deleting a field by providing the null attribute to an add operation. In the example below, the field skills should be deleted from the document with “employeeId” 05991:
<add>
<doc>
<field name="employeeId">05991</field>
<field name="skills" update="set" null="true" />
</doc>
</add>
I would expect that the following call would be equivalent to the xml above:
docs = [{'empolyeeId':05991, 'skills':None}]
solr.add(docs, fieldUpdates={'skills':'set'})
Actual behaviour
As far as I understand, this operation is not yet supported in pysolr. I could not find a way to input the null attribute to the add method of Solr class.
Configuration
- Operating system version: Ubuntu 14.04, kernel 3.16.0-77-generic
- Search engine version: 4.7
- Python version: 2.7.6
- pysolr version: 3.5.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:8
Top Results From Across the Web
How to remove a field completely from a MongoDB document?
Yes, you have to use $unset operator, but this unset is going to remove the words key which does not exist for a...
Read more >How to Remove a Field from a MongoDB Document ($unset)
In MongoDB, you can use the $unset field update operator to completely remove a field from a document. The $unset operator is designed ......
Read more >Removing Specific Fields - Microsoft Word Tips
If you use fields in your documents, you may need a way to delete a specific type of field, while leaving all the...
Read more >How to remove a field from a document in MongoDB
In MongoDB, The $unset operator is used to delete or remove a particular field. Consider the following syntax: { $unset: { <field1>: "",...
Read more >MongoDB: How to Remove a Field from Every Document
You can use the following methods to remove fields from every document in a collection in MongoDB: Method 1: Remove One Field db.collection....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I updated the _build_doc method. At the moment it doesn’t do anything if there is a ‘null value’ passed. I have added in an extra check if the user passes in an empty string or list and they are doing a ‘set’ fieldUpdate then it will add in the document but will also add an extra attribute null=true. This works for me as I am passing in empty lists, it wouldn’t work if someone passed in field=None. `
`
so is this fixed then?