etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.2k stars 130 forks source link

No search result for exact string but for similiar strings #242

Closed Patrick-Berg closed 4 years ago

Patrick-Berg commented 6 years ago

I'm using watson 1.5.2 with Postgresql to look for contacts in an adress book via phone number. Now there's some odd behaviour. The numbers are stored as strings in the format "+12 3456 7890123" I'm getting results for queries on "3456 7890123" but none for "+12 3456 7890123", "12 3456 7890123" or when I use queries without white spaces. I'm using watson.filter(searchmodel, query) so nothing out of the ordinary. Is this a known issue? It isn't really a big deal for manual searches because most people don't search for the full number but I'm also getting requests to a REST API which is used by a programm connected to a TAPI.

etianen commented 6 years ago

I created a test case for this, and I can't reproduce your issue:

    def testSearchPhoneNumber(self):
        WatsonTestModel1.objects.create(
            title="title model1 instance12",
            content="content model1 instance13 +12 3456 7890123",
            description="description model1 instance13",
        )
        self.assertEqual(watson.search("+12 3456 7890123").count(), 1)
GulaMerlin commented 5 years ago

How to do fuzzy query ?