django haystack how do I find substrings in words?
问题 In my field the content is "example". I want to find not only the exact word "example", I also want to find "examp". How can I do that? Are there any options. Can't find anything. 回答1: If you just want to search for objects starting with some string, then just look at Haystack SearchQuerySet API documentation. It resembles the Django QuerySet API, so it is possible to write: SearchQuerySet().filter(content__startswith='examp') SearchQuerySet().filter(content__contains='examp') or whatever you