Union of 2 SearchQuerySet in django haystack

705 Views Asked by At

Is there any way to get an union of two or more searchqueryset ? For example :-

query1 = SearchQuerySet().filter(authors=query)
query2 = SearchQuerySet().filter(title=query)

How do I combine both the queries together so that i get a union of the 2 queries ?

1

There are 1 best solutions below

4
On BEST ANSWER

SearchQuerySet implements the QuerySet interface to some extent, so you can try:

query1 | query2