Search backend for users

        :param searchstring: the search string
        :type searchstring: string
        :rtype: dict of dict ( {<user attr key>: {<attr>: <value>}} )
182025
def search(self, searchstring):
        
        ret = {}
        for user in self.users:
            match = False
            for attr in self.search_attrs:
                if attr not in self.users[user]:
                    pass
                elif re.search(searchstring + '.*', self.users[user][attr]):
                    match = True
            if match:
                ret[user] = self.users[user]
        return ret
208109
def search(cls, query, search_opts=None):
        

        if search_opts is None:
            search_opts = {}

        xmlrpc = XMLRPCConnection()
        try:
            search_result = xmlrpc.connection.search_vrf(
                {
                    'query': query,
                    'search_options': search_opts,
                    'auth': AuthOptions().options
                })
        except xmlrpclib.Fault as xml_fault:
            raise _fault_to_exception(xml_fault)
        result = dict()
        result['result'] = []
        result['search_options'] = search_result['search_options']
        for v in search_result['result']:
            result['result'].append(VRF.from_dict(v))

        return result
1362128
def _get_query_parts(self, query_str, search_options=None):
        

        if search_options is None:
            search_options = {}

        if query_str is None:
            raise NipapValueError("'query_string' must not be None")

        # find query parts
        query_str_parts = []
        try:
            for part in shlex.split(query_str.encode('utf-8')):
                query_str_parts.append({ 'string': part.decode('utf-8') })
        except ValueError as exc:
            if unicode(exc) == 'No closing quotation':
                raise NipapValueError(unicode(exc))
            raise exc

        # Handle empty search.
        # We need something to iterate over, but shlex.split() returns
        # zero-element list for an empty string, so we have to append one
        # manually
        if len(query_str_parts) == 0:
            query_str_parts.append({ 'string': '' })

        return query_str_parts
565965
def _get_user(self, username):
        
        if username is None:
            return {}
        ret = {}
        for b in self.backends:
            try:
                tmp = self.backends[b].get_user(username)
            except UserDoesntExist as e:
                self._handle_exception(e)
                tmp = {}
            self._merge_user_attrs(tmp, ret, b)

        cherrypy.log.error(
            msg="user '" + username + "' attributes " + str(ret),
            severity=logging.DEBUG
        )
        return ret
686424
public function countNumberOfUserInSearch($searchString = null)
    {
        $builder = $this->buildUserSearchQuery($searchString);

        return $builder->select($builder->expr()->count('u.id'))
            ->getQuery()
            ->getSingleScalarResult();
    }
750159
def search(self, query, search_type, payload=None):
        ''''''
        url = self.url + search_type
        headers = {'User-Agent': self.user_agent}

        if payload is not None:
           payload['Query'] = quote(query)
        else:
            payload = {'Query': quote(query)}

        request = requests.get(url, auth=self.auth, params=payload, headers=headers)
        return request
1052398
def searches(self):
        
        return self._get_object(
            regex=re.compile(
                r'((?<=\n)|(?<=^))(?P<title>\[Searches\]:) *(?P<tagString>( *?@\S*(\(.*?\))?)+)?(?P<content>(\n(    |\t).*)*)', re.UNICODE),
            objectType="searchBlock",
            content=None
        )
582688
def search(q, **kwargs):
    ''''''
    data = {'q': q}
    for key, value in kwargs.items():
        if value:
            if type(value) == bool:
                data[key] = 'on'
            else:
                data[key] = value
    return _unpaginated('search/?' + urlencode(data))
274845
def search(search_type, klass, query, options = false)
      header = {}

      # Required Data
      data = {
        'SearchType' => search_type,
        'Class'      => klass,
        'Query'      => query,
        'QueryType'  => 'DMQL2',
        'Format'     => format,
        'Count'      => '0'
      }

      # Options
      #--
      # We might want to switch this to merge!, but I've kept it like this for now because it
      # explicitly casts each value as a string prior to performing the search, so we find out now
      # if can't force a value into the string context. I suppose it doesn't really matter when
      # that happens, though...
      #++
      options.each { |k,v| data[k] = v.to_s } if options

      response = request(@urls.search, data, header)

      # TODO: make parser configurable
      results = RETS4R::Client::CompactNokogiriParser.new(response.body)

      if block_given?
        results.each {|result| yield result}
      else
        return results.to_a
      end
    end
1017284
def query(self, queryString):
    '''
    
    '''
    self._setHeaders('query')
    return self._sforce.service.query(queryString)
246035
def parse_querystring(self, req: Request, name: str, field: Field) -> typing.Any:
        """"""
        return core.get_value(req.query, name, field)
869093
def timeOneSearch(queryString):
    
    startTime = time.clock()
    resultString = backend.runSearchVariants(queryString)
    endTime = time.clock()
    elapsedTime = endTime - startTime
    return resultString, elapsedTime
650821
def check_searching_param(searching_param, allowed)
      🔞 = searching_param.keys.map(&:to_sym) - allowed.map(&:to_sym)
      raise InvalidSearchException, "Attributes #{🔞.map(&:to_s).to_sentence} doesn't exists or aren't searchables. Available searchs are: #{allowed.to_sentence}" if 🔞.any?
    end
1198837
def LookupWithType(self, user_str):
        
        prefix = 'template '
        ref = None  # fail the lookup by default
        if user_str.startswith(prefix):
            name = user_str[len(prefix):]
            if name == 'SELF':
                # we can resolve this right away
                ref = _TemplateRef(template=self.owner)  # special value
            else:
                ref = _TemplateRef(name)
        
        return ref, (), TEMPLATE_FORMATTER
219695
protected final List<T> searchSorted(String searchString, String sort) {
        return this.dataAccess.searchSorted(searchString, sort);
    }
593843
def search_with_additional_term_string(self, filterstr):
        
        filterstr = "(&{}{})".format(self.filterstr, filterstr)

        return self.__class__(
            self.base_dn, self.scope, filterstr, attrlist=self.attrlist
        )
923720
def search(self, query, indices=None, doc_types=None, model=None, scan=False, headers=None, **query_params):
        
        if isinstance(query, Search):
            search = query
        elif isinstance(query, (Query, dict)):
            search = Search(query)
        else:
            raise InvalidQuery("search() must be supplied with a Search or Query object, or a dict")

        if scan:
            query_params.setdefault("search_type", "scan")
            query_params.setdefault("scroll", "10m")

        return ResultSet(self, search, indices=indices, doc_types=doc_types,
                         model=model, query_params=query_params, headers=headers)