Return a search using the combined query of all associated special coverage objects.
493207
def search(self):
        """"""
        # Retrieve all Or filters pertinent to the special coverage query.
        should_filters = [
            es_filter.Terms(pk=self.query.get("included_ids", [])),
            es_filter.Terms(pk=self.query.get("pinned_ids", []))
        ]
        should_filters += self.get_group_filters()

        # Compile list of all Must filters.
        must_filters = [
            es_filter.Bool(should=should_filters),
            ~es_filter.Terms(pk=self.query.get("excluded_ids", []))
        ]

        return Content.search_objects.search().filter(es_filter.Bool(must=must_filters))
144093
def search(request, template="search_results.html", extra_context=None):
    
    query = request.GET.get("q", "")
    page = request.GET.get("page", 1)
    per_page = settings.SEARCH_PER_PAGE
    max_paging_links = settings.MAX_PAGING_LINKS
    try:
        parts = request.GET.get("type", "").split(".", 1)
        search_model = apps.get_model(*parts)
        search_model.objects.search  # Attribute check
    except (ValueError, TypeError, LookupError, AttributeError):
        search_model = Displayable
        search_type = _("Everything")
    else:
        search_type = search_model._meta.verbose_name_plural.capitalize()
    results = search_model.objects.search(query, for_user=request.user)
    paginated = paginate(results, page, per_page, max_paging_links)
    context = {"query": query, "results": paginated,
               "search_type": search_type}
    context.update(extra_context or {})
    return TemplateResponse(request, template, context)
418155
def _do_search(self):
        
        if self._results_cache is None:
            response = self.raw()
            ResultsClass = self.get_results_class()
            results = self.to_python(response.get('hits', {}).get('hits', []))
            self._results_cache = ResultsClass(
                self.type, response, results, self.fields)
        return self._results_cache
1021587
def search(self, query: Optional[dict] = None, offset: Optional[int] = None,
               limit: Optional[int] = None,
               order_by: Union[None, list, tuple] = None) -> Sequence['IModel']:
        """"""
        raise NotImplementedError
765311
def _query(options, collection_name, num_to_skip,
           num_to_return, query, field_selector, opts, check_keys):
    """"""
    encoded = _dict_to_bson(query, check_keys, opts)
    if field_selector:
        efs = _dict_to_bson(field_selector, False, opts)
    else:
        efs = b""
    max_bson_size = max(len(encoded), len(efs))
    return b"".join([
        _pack_int(options),
        _make_c_string(collection_name),
        _pack_int(num_to_skip),
        _pack_int(num_to_return),
        encoded,
        efs]), max_bson_size
625775
def results(self):
        
        if not self.in_search_mode():
            return self.get_queryset()

        # we are doing a search
        objects = self.search()

        # if objects isn't a Search object, just return it, since it's
        # (hopefully) just a list or queryset.
        if not isinstance(objects, Search):
            return objects

        if not self.is_valid_query(objects):
            self.add_error(None, forms.ValidationError("Invalid Query", code="invalid-query"))
            return []

        # convert the search results to something that can be iterated over, and paged
        return Pageable(objects, self.get_queryset())
1064387
def _all(self, query):
        """"""
        if query.count() > 0:
            results = query.all()
            for result in results:
                if result.has_expired(self._expirations):
                    raise NotFoundError
            return results
        else:
            raise NotFoundError
343758
def get_objects(self, search_field, search_val):
        """"""
        query = ("{ size: " + str(self.max_hits) + ", " +
                 "query: { filtered: { filter: { " +
                 search_field + ": { value: \"" + search_val + "\"" +
                 " } } } } } }")
        self.connect_es()
        res = self.es.search(index=self.index, body=query)
        # self.pr_dbg("%d Hits:" % res['hits']['total'])
        objects = {}
        for doc in res['hits']['hits']:
            objects[doc['_id']] = {}
            # To make uploading easier in the future:
            # Record all those bits into the backup.
            # Mimics how ES returns the result.
            # Prevents having to store this in some external, contrived, format
            objects[doc['_id']]['_index'] = self.index  # also in doc['_index']
            objects[doc['_id']]['_type'] = doc['_type']
            objects[doc['_id']]['_id'] = doc['_id']
            objects[doc['_id']]['_source'] = doc['_source']  # the actual result
        return objects
360316
def query_all(self):
        
        if DJANGO_20_PLUS:
            obj = self._clone()
        else:
            obj = self._clone(klass=SalesforceQuerySet)  # pylint: disable=unexpected-keyword-arg
        obj.query.set_query_all()
        return obj
192113
def getSearch(self):
        """"""
        return Search(self.getColumns(), Sitools2Abstract.getBaseUrl(self) + self.getUri())
164978
def search(query, model):
    
    query = query.strip()
    LOGGER.debug(query)
    sqs = SearchQuerySet()
    results = sqs.raw_search('{}*'.format(query)).models(model)
    if not results:
        results = sqs.raw_search('*{}'.format(query)).models(model)
    if not results:
        results = sqs.raw_search('*{}*'.format(query)).models(model)

    return [o.pk for o in results]
126116
def search(self, pattern):
        
        try:
            return self.advanced_search(pattern)
        except Exception:
            return self.basic_search(pattern)
223369
def get_authorizations_by_search(self, authorization_query, authorization_search):
        """"""
        # Implemented from azosid template for -
        # osid.resource.ResourceSearchSession.get_resources_by_search_template
        if not self._can('search'):
            raise PermissionDenied()
        return self._provider_session.get_authorizations_by_search(authorization_query, authorization_search)
1279426
public SearchResponse searchAll(String[] indices, String[] types,
            AggregationBuilder[] aggregationBuilders) {
        return searchAll(indices, types, null, aggregationBuilders);
    }
240173
def get_queryset(self):
        
        queryset    = super(IndexView, self).get_queryset()
        search_form = self.get_search_form()

        if search_form.is_valid():
            query_str   = search_form.cleaned_data.get('q', '').strip()
            queryset    = self.model.objects.search(query_str)

        return queryset
717545
def apply(self, search, field, value):
        """"""
        return search.query(
            self.query_type(  # pylint: disable=not-callable
                **{
                    field: {
                        self.operator: self.get_value_query(value)
                    }
                }
            )
        )
105718
public SearchResponse searchAll(boolean isSetExplain, String[] indices,
            String[] types, QueryBuilder filterQueryBuilder) {
        return searchAll(isSetExplain, indices, types,
                filterQueryBuilder, null);
    }