Skip to content

Commit

Permalink
Add test to verify content is not searching non-document fields
Browse files Browse the repository at this point in the history
  • Loading branch information
asedeno committed Sep 20, 2021
1 parent 70e475b commit 1d3be9d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/xapian_tests/tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ def test_content_search(self):
# documents with "medium" AND "this" have higher score
self.assertEqual(pks(result)[:4], [1, 4, 7, 10])

def test_content_search2(self):
# content should only search the document, not all fields.
result = self.queryset.filter(content='summary')
self.assertEqual(pks(result), [])


def test_field_search(self):
self.assertEqual(pks(self.queryset.filter(name__contains='8')), [4])
self.assertEqual(pks(self.queryset.filter(type_name='book')),
Expand Down

0 comments on commit 1d3be9d

Please sign in to comment.