Exemple #1
0
 def __init__(self, query, order_by='relevant', **kwargs):
     super(BaseSearch, self).__init__(**kwargs)
     # Normalize the search
     self.include_terms, self.exclude_terms = terms_from_search_string(
         query)
     self.query = search_string_from_terms(self.include_terms,
                                           self.exclude_terms)
     self.raw_query = query
     self.order_by = order_by
     if order_by not in self.order_by_map:
         raise UnhandledSearch(u"{0} does not support an ordering called "
                               u"{1}".format(self.__class__.__name__,
                                             order_by))
Exemple #2
0
    def __init__(self, query, suite, fields=None, order_by=None,
                 crawl=False, max_results=None, api_keys=None):
        self.include_terms, self.exclude_terms = terms_from_search_string(
            query)
        self.query = search_string_from_terms(self.include_terms,
                                              self.exclude_terms)
        self.raw_query = query
        self.suite = suite
        self.fields = fields
        self.order_by = order_by
        self.crawl = crawl
        self._max_results = max_results
        self.api_keys = api_keys if api_keys is not None else {}

        self.total_results = None
        self.time = None