Given the search term “big file larger desk”, how would I search for 1) any of the results; and 2) all of the results.
The search I am currently doing is:
results = Path.objects.filter(path__icontains=search)
What I need to do is something along the lines of:
results = Path.objects.filter(path__icontains=search.split())
How would I do both of these? (OR or AND)
The first thing you need to know is that you are not actually hitting the database when you filter, so you can do the filtering multiple times without losing to much performance, a first approach can be:
that is for AND ans you can use a similar approach for or.