mirror of
https://github.com/Hopiu/xapian-haystack.git
synced 2026-05-11 16:53:14 +00:00
Fixed SearchBackend.update not updating existing documents, but instead appending to index
This commit is contained in:
parent
0d77e02d80
commit
9cb2305a61
2 changed files with 2 additions and 1 deletions
|
|
@ -84,6 +84,7 @@ class XapianSearchBackendTestCase(TestCase):
|
|||
|
||||
def test_update(self):
|
||||
self.sb.update(self.msi, self.sample_objs)
|
||||
self.sb.update(self.msi, self.sample_objs) # Duplicates should be updated, not appended -- http://github.com/notanumber/xapian-haystack/issues/#issue/6
|
||||
|
||||
self.assertEqual(len(self.xapian_search('')), 3)
|
||||
self.assertEqual([dict(doc) for doc in self.xapian_search('')], [{'name': u'david1', 'text': u'Indexed!\n1', 'pub_date': u'2009-02-24T00:00:00', 'id': u'tests.mockmodel.1'}, {'name': u'david2', 'text': u'Indexed!\n2', 'pub_date': u'2009-02-23T00:00:00', 'id': u'tests.mockmodel.2'}, {'name': u'david3', 'text': u'Indexed!\n3', 'pub_date': u'2009-02-22T00:00:00', 'id': u'tests.mockmodel.3'}])
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ class SearchBackend(BaseSearchBackend):
|
|||
(obj._meta.app_label, obj._meta.module_name)
|
||||
)
|
||||
|
||||
database.replace_document(document_id, document)
|
||||
database.replace_document(DOCUMENT_ID_TERM_PREFIX + document_id, document)
|
||||
|
||||
database.set_metadata('fields', pickle.dumps(set(fields)))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue