use lunr search index to find a page based on specified search term
167212
function(req, res) {
        if (!searchIdx) return res();
        var results = searchIdx.search(req.term)
          .map(function(result) {
            return {
              label: files[result.ref].title,
              value: files[result.ref]
            };
          });

        res(results);
      }
610400
def _inner_search(obj, glob, separator, dirs=True, leaves=False):
    """"""
    for path in dpath.path.paths(obj, dirs, leaves, skip=True):
        if dpath.path.match(path, glob):
            yield path
631279
def search_url(obj, url_data, pageno, seen_objs):
    """"""
    if isinstance(obj, PDFObjRef):
        if obj.objid in seen_objs:
            # prevent recursive loops
            return
        seen_objs.add(obj.objid)
        obj = obj.resolve()
    if isinstance(obj, dict):
        for key, value in obj.items():
            if key == 'URI' and isinstance(value, basestring):
                # URIs should be 7bit ASCII encoded, but be safe and encode
                # to unicode
                # XXX this does not use an optional specified base URL
                url = strformat.unicode_safe(value)
                url_data.add_url(url, page=pageno)
            else:
                search_url(value, url_data, pageno, seen_objs)
    elif isinstance(obj, list):
        for elem in obj:
            search_url(elem, url_data, pageno, seen_objs)
    elif isinstance(obj, PDFStream):
        search_url(obj.attrs, url_data, pageno, seen_objs)
40101
def search(query, n_results, web):
    
    if web:
        secho(u'Opening search page for "{0}"...'.format(query), bold=True)
        url = SEARCH_URL.format(query=urlquote(query))
        click.launch(url)
    else:
        searcher = Searcher()
        results = searcher.search(query, n=n_results)
        first_line = style(u'Search results for "{0}"\n'.format(query),
                           bold=True)
        echo_via_pager(
            first_line +
            '\n'.join([format_result(result) for result in results])
        )
1248488
def search(self, query, relation=None, index=0, limit=25, **kwargs):
        
        return self.get_object(
            "search", relation=relation, q=query, index=index, limit=limit, **kwargs
        )
247519
def search(self, search_phrase, limit=None):
        

        query_string = self._make_query_from_terms(search_phrase)
        self._parsed_query = query_string
        schema = self._get_generic_schema()
        parser = QueryParser('doc', schema=schema)
        query = parser.parse(query_string)
        logger.debug('Searching partitions using `{}` query.'.format(query))
        with self.index.searcher() as searcher:
            results = searcher.search(query, limit=limit)
            for hit in results:
                yield PartitionSearchResult(
                    vid=hit['vid'], dataset_vid=hit['dataset_vid'], score=hit.score)
1361468
def _get_splunk_search_props(search):
    '''
    
    '''
    props = search.content
    props["app"] = search.access.app
    props["sharing"] = search.access.sharing
    return props
1289385
def _search(self, model, condition=None, search_field='name',
                value_field='id', label_field=None, pagination=True):
        
        from uliweb import json, request

        name = request.GET.get('term', '')
        M = functions.get_model(model)

        def _v(label_field):
            if label_field:
                return lambda x: getattr(x, label_field)
            else:
                return lambda x: unicode(x)

        v_field = request.values.get('label', 'title')
        page = int(request.values.get('page') or 1)
        limit = int(request.values.get('limit') or 10)
        v_func = _v(label_field)
        if name:
            if condition is None:
                condition = M.c[search_field].like('%' + name + '%')
            if pagination:
                query = M.filter(condition)
                total = query.count()
                rows = [{'id': getattr(obj, value_field), v_field: v_func(obj)}
                            for obj in query.limit(limit).offset((page-1)*limit)]
                result = {'total':total, 'rows':rows}
            else:
                result = [{'id': getattr(obj, value_field), v_field: v_func(obj)}
                      for obj in M.filter(condition)]
        else:
            result = []
        return json(result)
1114418
def find_resources(self, rsrc_type, sort=None, yield_pages=False, **kwargs):
        """"""
        return rsrc_type.find(self, sort=sort, yield_pages=yield_pages, **kwargs)
558243
def raw_content(self, output=None, str_output=None):
        """"""
        return self._search_page(output, str_output, self.response.data, lambda regex, content: regex.search(content.decode()))
364148
def custom_search(self, index, doc_type):
        '''
        
        '''
        from bungiesearch import Bungiesearch
        return Bungiesearch(raw_results=True).index(index).doc_type(doc_type)
361264
def search(query, data, replacements=None):
    """"""
    query = q.Query(query, params=replacements)
    for entry in data:
        if solve.solve(query, entry).value:
            yield entry
1102590
def page(self, i):
		""""""
		# Need to clear previous results.
		self.torrents = list()
		self._current_page = i
		self.search(term=self.term, category=self.category,
					sort=self.sort, order=self.order)
166735
def find(term, limit = nil, offset = nil, page = nil)
      raise ArgumentError.new("Missing search term") unless term

      search = OAuth::Helper.escape(term)
      search += "?limit_to_public_domain=#{NounProjectApi.configuration.public_domain ? 1 : 0}"

      args = {
        "limit" => limit,
        "offset" => offset,
        "page" => page
      }.reject { |_, v| v.nil? }
      args.each { |k, v| search += "&#{k}=#{v}" } if args.size > 0

      result = access_token.get("#{API_BASE}#{API_PATH}#{search}")
      raise ServiceError.new(result.code, result.body) unless %w(200 404).include? result.code

      if result.code == "200"
        JSON.parse(result.body)["icons"].map { |icon| Icon.new(icon) }
      else
        []
      end
    end
373025
def search(self, terms):
        
        # load the search information
        if not self._searchurls:
            base = self.tempFilepath()
            root_url = projex.text.underscore(self.text(0))
            for root, folders, files in os.walk(base):
                if '_static' in root:
                    continue
                
                for file in files:
                    if not file.endswith('.html'):
                        continue
                    
                    filename = os.path.join(root, file)
                    url = filename[len(base)+1:].replace('\\', '/')
                    url = root_url + '/' + url.strip('/')
                    url = url.replace('.html', '')
                    
                    f = open(filename, 'r')
                    content = f.read()
                    f.close()
                    
                    self._searchurls[url] = content

        # search for the contents
        output = [] # [(<int> strength>
        term_list = nativestring(terms).split(' ')
        for url, html in self._searchurls.items():
            title           = self.titleForFilepath(url)
            strength        = 0
            all_title_found = True
            all_found       = True
            
            for term in term_list:
                if ( term == title ):
                    strength += 5
                
                elif ( term.lower() == title.lower() ):
                    strength += 4
                    
                elif ( term in title ):
                    strength += 3
                
                elif ( term.lower() in title.lower() ):
                    strength += 2
                
                else:
                    all_title_found = False
                
                if ( not term in html ):
                    all_found = False
                else:
                    strength += 1
            
            if ( all_title_found ):
                strength += len(terms) * 2
            
            if ( all_found ):
                strength += len(terms)
            
            # determine the strength
            if ( strength ):
                output.append({'url': url, 
                               'title': self.titleForFilepath(url),
                               'strength': strength})
        
        return output
1159885
def search(self):
        ""
        form = forms.HomeForm()
        bbm_filter = bs_filters.BookmarkBukuFilter(
            all_keywords=False, deep=form.deep.data, regex=form.regex.data)
        op_text = bbm_filter.operation()
        values_combi = sorted(itertools.product([True, False], repeat=3))
        for idx, (all_keywords, deep, regex) in enumerate(values_combi):
            if deep == form.deep.data and regex == form.regex.data and not all_keywords:
                choosen_idx = idx
        url_op_text = op_text.replace(', ', '_').replace('  ', ' ').replace(' ', '_')
        key = ''.join(['flt', str(choosen_idx), '_buku_', url_op_text])
        kwargs = {key: form.keyword.data}
        url = url_for('bookmark.index_view', **kwargs)
        return redirect(url)
383793
def explicit_rel_links(self, rels=('homepage', 'download')):
        """"""
        for match in self._rel_re.finditer(self.content):
            found_rels = match.group(1).lower().split()
            for rel in rels:
                if rel in found_rels:
                    break
            else:
                continue
            match = self._href_re.search(match.group(0))
            if not match:
                continue
            url = match.group(1) or match.group(2) or match.group(3)
            url = self.clean_link(urlparse.urljoin(self.base_url, url))
            yield Link(url, self)