Created
February 26, 2015 15:44
-
-
Save kaedroho/e86e3402936154ccdd79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from wagtail.wagtailsearch.backends import get_search_backend | |
from wagtail.wagtailsearch.backends.elasticsearch import ElasticSearchResults | |
class AwesomeQuery(object): | |
def __init__(self, search_query, campaign, country, language): | |
self.search_query = search_query | |
self.campaign = campaign | |
self.country = country | |
self.language = language | |
@property | |
def queryset(self): | |
# Just has to return any queryset of Page | |
# This is used by ElasticSearchResults to find the model to return | |
return Page.objects.all() | |
def to_es(self): | |
# TODO | |
def search(search_query, campaign, country, language): | |
s = get_search_backend() | |
return ElasticSearchResults(s, AwesomeQuery(search_query, campaign, country, language)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment