returns a search result object from search.maven.com
 see input and output format at http://search.maven.org/#api
763853
def search(params)
      response = get("http://search.maven.org/solrsearch/select?", params.merge("rows" => "100", "wt" => "json"))
      json = JSON.parse(response.to_s)
      json["response"]["docs"]
    end
950639
def result_object(index)
      klass = "Udongo::Search::ResultObjects::#{namespace}::#{index.searchable_type}"
      klass = 'Udongo::Search::ResultObjects::Base' unless result_object_exists?(klass)
      klass.constantize.new(index, search_context: self)
    end
843863
def search(self, queryType, query=None, vendorSpecific=None, **kwargs):
        
        response = self.searchResponse(queryType, query, vendorSpecific, **kwargs)
        return self._read_dataone_type_response(response, 'ObjectList')
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
210076
@GET
    public Response search()
            throws IOException {
        return execute(getResourceRequest(RequestTypeEnum.GET, RestOperationTypeEnum.SEARCH_TYPE));
    }
1031383
def _find(api_method, query, limit, return_handler, first_page_size, **kwargs):
    ''' 
    '''
    num_results = 0

    if "limit" not in query:
        query["limit"] = first_page_size

    while True:
        resp = api_method(query, **kwargs)

        by_parent = resp.get('byParent')
        descriptions = resp.get('describe')
        def format_result(result):
            if return_handler:
                result = dxpy.get_handler(result['id'], project=result.get('project'))
            if by_parent is not None:
                return result, by_parent, descriptions
            else:
                return result

        for i in resp["results"]:
            if num_results == limit:
                return
            num_results += 1
            yield format_result(i)

        # set up next query
        if resp["next"] is not None:
            query["starting"] = resp["next"]
            query["limit"] = min(query["limit"]*2, 1000)
        else:
            return
940280
def search(query, options={})
      params = { :query => query, :lang => @query_options[:lang], :limit => @query_options[:limit] }.merge(options)
      response = get(surl('search'), params, format: :json)
      response['result']
    end
737619
public String displaySearchResult(CmsSearch search) {

        initSearch(search);
        StringBuffer result = new StringBuffer(800);
        CmsMessages messages = org.opencms.search.Messages.get().getBundle(m_jsp.getRequestContext().getLocale());

        result.append("<h1>\n");
        result.append(messages.key(org.opencms.search.Messages.GUI_HELP_SEARCH_RESULT_TITLE_0));
        result.append("\n</h1>\n");
        List<CmsSearchResult> searchResult;
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(search.getQuery())) {
            search.setQuery("");
            searchResult = new ArrayList<CmsSearchResult>();
        } else {
            searchResult = search.getSearchResult();
        }

        HttpServletRequest request = m_jsp.getRequest();
        // get the action to perform from the request
        String action = request.getParameter("action");

        if ((action != null) && (searchResult == null)) {
            result.append("<p class=\"formerror\">\n");
            if (search.getLastException() != null) {

                result.append(messages.key(org.opencms.search.Messages.GUI_HELP_SEARCH_UNAVAILABLE_0));
                result.append("\n<!-- ").append(search.getLastException().toString());
                result.append(" //-->\n");
            } else {
                result.append(
                    messages.key(
                        org.opencms.search.Messages.GUI_HELP_SEARCH_NOMATCH_1,
                        CmsEncoder.escapeXml(search.getQuery())));
                result.append("\n");
            }
            result.append("</p>\n");
        } else if ((action != null) && (searchResult.size() <= 0)) {
            result.append("<p class=\"formerror\">\n");
            result.append(
                messages.key(
                    org.opencms.search.Messages.GUI_HELP_SEARCH_NOMATCH_1,
                    CmsEncoder.escapeXml(search.getQuery())));
            result.append("\n");
            result.append("</p>\n");
        } else if ((action != null) && (searchResult.size() > 0)) {
            result.append("<p>\n");
            result.append(messages.key(org.opencms.search.Messages.GUI_HELP_SEARCH_RESULT_START_0));
            result.append("\n");
            result.append("</p>\n<p>\n");

            Iterator<CmsSearchResult> iterator = searchResult.iterator();

            try {
                if (m_exportLinks) {
                    m_jsp.getRequestContext().setCurrentProject(m_onlineProject);
                }

                while (iterator.hasNext()) {
                    CmsSearchResult entry = iterator.next();
                    result.append("\n<div class=\"searchResult\"><a class=\"navhelp\" href=\"");

                    result.append(
                        m_jsp.link(
                            new StringBuffer(
                                "/system/modules/org.opencms.workplace.help/jsptemplates/help_body.jsp?helpresource=").append(
                                    m_jsp.getRequestContext().removeSiteRoot(entry.getPath())).append("&").append(
                                        CmsLocaleManager.PARAMETER_LOCALE).append("=").append(
                                            m_jsp.getRequestContext().getLocale()).toString()));
                    result.append("\">\n");
                    result.append(entry.getField(CmsSearchField.FIELD_TITLE));
                    result.append("</a>");
                    result.append("&nbsp;(").append(entry.getScore()).append("&nbsp;%)\n");
                    result.append("<span class=\"searchExcerpt\">\n");
                    result.append(entry.getExcerpt()).append('\n');
                    result.append("</span>\n");
                    result.append("</div>\n");
                }
            } finally {
                m_jsp.getRequestContext().setCurrentProject(m_offlineProject);
            }

            result.append("</p>\n");

            // search page links below results
            if ((search.getPreviousUrl() != null) || (search.getNextUrl() != null)) {
                result.append("<p>");
                if (search.getPreviousUrl() != null) {

                    result.append("<a href=\"");
                    result.append(
                        getSearchPageLink(
                            m_jsp.link(new StringBuffer(search.getPreviousUrl()).append('&').append(
                                CmsLocaleManager.PARAMETER_LOCALE).append("=").append(
                                    m_jsp.getRequestContext().getLocale()).toString())));
                    result.append("\">");
                    result.append(messages.key(org.opencms.search.Messages.GUI_HELP_BUTTON_BACK_0));
                    result.append(" &lt;&lt;</a>&nbsp;&nbsp;\n");
                }
                Map<Integer, String> pageLinks = search.getPageLinks();
                Iterator<Integer> i = pageLinks.keySet().iterator();
                while (i.hasNext()) {
                    int pageNumber = i.next().intValue();
                    result.append(" ");
                    if (pageNumber != search.getSearchPage()) {
                        result.append("<a href=\"").append(
                            getSearchPageLink(
                                m_jsp.link(new StringBuffer(pageLinks.get(new Integer(pageNumber))).append('&').append(
                                    CmsLocaleManager.PARAMETER_LOCALE).append("=").append(
                                        m_jsp.getRequestContext().getLocale()).toString())));
                        result.append("\" target=\"_self\">").append(pageNumber).append("</a>\n");
                    } else {
                        result.append(pageNumber);
                    }
                }
                if (search.getNextUrl() != null) {
                    result.append("&nbsp;&nbsp;&nbsp;<a href=\"");
                    result.append(
                        getSearchPageLink(
                            new StringBuffer(m_jsp.link(search.getNextUrl())).append('&').append(
                                CmsLocaleManager.PARAMETER_LOCALE).append("=").append(
                                    m_jsp.getRequestContext().getLocale()).toString()));
                    result.append("\">&gt;&gt;");
                    result.append(messages.key(org.opencms.search.Messages.GUI_HELP_BUTTON_NEXT_0));
                    result.append("</a>\n");
                }
                result.append("</p>\n");
            }

        }

        // include the post forms for the page links:
        Iterator<String> values = m_formCache.values().iterator();
        while (values.hasNext()) {
            result.append(values.next());
        }
        return result.toString();

    }
842449
def search_result_document(search_params)
        _, document_list = search_results(search_params)
        return document_list.first unless document_list.empty?
        document_not_found!
      end
257870
private List<CmsSearchResult> getSearchResults(Map<String, String> params) {

        if (m_searchResults == null) {
            m_searchResults = getSearchBean(params).getSearchResult();
        }
        return m_searchResults;
    }
220985
def query(input, representation, resolvers=None, **kwargs):
    
    apiurl = API_BASE+'/%s/%s/xml' % (urlquote(input), representation)
    if resolvers:
        kwargs['resolver'] = ",".join(resolvers)
    if kwargs:
        apiurl+= '?%s' % urlencode(kwargs)
    result = []
    try:
        tree = ET.parse(urlopen(apiurl))
        for data in tree.findall(".//data"):
            datadict = {'resolver':data.attrib['resolver'],
                        'notation':data.attrib['notation'],
                        'value':[]}
            for item in data.findall("item"):
                datadict['value'].append(item.text)
            if len(datadict['value']) == 1:
                datadict['value'] = datadict['value'][0]
            result.append(datadict)
    except HTTPError:
        # TODO: Proper handling of 404, for now just returns None
        pass
    return result if result else None
619039
def search(self, keyword):
        
        params = {
            "source": "map",
            "description": keyword
        }
        data = self._request(ENDPOINTS['SEARCH'], params)
        data['result_data'] = [res for res in data['result_data'] if isinstance(res, dict)]
        return data
1333399
def search(query)
      options = {:path => page_file_dir, :ref => ref}
      results = {}
      @repo.git.grep(query, options).each do |hit|
        name = hit[:name]
        count = hit[:count]
        # Remove ext only from known extensions.
        # test.pdf => test.pdf, test.md => test
        file_name = Page::valid_page_name?(name) ? name.chomp(::File.extname(name)) : name
        results[file_name] = count.to_i
      end

      # Use git ls-files '*query*' to search for file names. Grep only searches file content.
      # Spaces are converted to dashes when saving pages to disk.
      @repo.git.ls_files(query.gsub(' ','-'), options).each do |path|
        # Remove ext only from known extensions.
        file_name          = Page::valid_page_name?(path) ? path.chomp(::File.extname(path)) : path
        # If there's not already a result for file_name then
        # the value is nil and nil.to_i is 0.
        results[file_name] = results[file_name].to_i + 1;
      end

      results.map do |key, val|
        { :count => val, :name => key }
      end
    end
317174
ProjectBuildingResult getProjectBuildingResult(MavenModelResource pomResource) throws ProjectBuildingException
   {
      ProjectBuildingResult result = cacheProject.get(pomResource.getFullyQualifiedName());
      if (result == null)
      {
         try
         {
            ProjectBuildingRequest request = getProjectBuildingRequest();
            Assert.notNull(request, "Project building request was null");
            request.setResolveDependencies(true);
            boolean inTransaction = !pomResource.getUnderlyingResourceObject().exists();
            // FORGE-1287
            if (inTransaction)
            {
               result = getProjectBuilder().build(new FileResourceModelSource(pomResource), request);
               // If under a transaction, don't start monitoring
            }
            else
            {
               result = getProjectBuilder().build(pomResource.getUnderlyingResourceObject(), request);
               monitorResource(pomResource);
            }
         }
         catch (ProjectBuildingException pbe)
         {
            List<ProjectBuildingResult> results = pbe.getResults();
            if (results != null && results.size() > 0)
               result = results.get(0);
            throw pbe;
         }
         finally
         {
            if (result != null && !Projects.isCacheDisabled())
               cacheProject.put(pomResource.getFullyQualifiedName(), result);
         }
      }
      return result;
   }
270412
def _search_solr(self, line):
        """"""
        try:
            query_str = self._create_solr_query(line)
            client = d1_cli.impl.client.CLICNClient(
                **self._cn_client_connect_params_from_session()
            )
            object_list_pyxb = client.search(
                queryType=d1_common.const.DEFAULT_SEARCH_ENGINE,
                query=query_str,
                start=self._session.get(d1_cli.impl.session.START_NAME),
                rows=self._session.get(d1_cli.impl.session.COUNT_NAME),
            )
            d1_cli.impl.util.print_info(self._pretty(object_list_pyxb.toxml("utf-8")))
        except d1_common.types.exceptions.ServiceFailure as e:
            e = "%".join(str(e).splitlines())  # Flatten line
            regexp = re.compile(
                r"errorCode: (?P<error_code>\d+)%.*%Status code: (?P<status_code>\d+)"
            )
            result = regexp.search(e)
            if (
                (result is not None)
                and (result.group("error_code") == "500")
                and (result.group("status_code") == "400")
            ):  # noqa: E129
                result = re.search(
                    r"<b>description</b> <u>(?P<description>[^<]+)</u>", e
                )
                msg = re.sub(
                    "&([^;]+);",
                    lambda m: chr(html.entities.name2codepoint[m.group(1)]),
                    result.group("description"),
                )
                d1_cli.impl.util.print_info("Warning: %s" % msg)
            else:
                d1_cli.impl.util.print_error("Unexpected error:\n%s" % str(e))
1008221
@Override
    public IterableResult<Extension> search(ExtensionQuery query) throws SearchException
    {
        return RepositoryUtils.search(query, this.repositories);
    }
478459
def _process_search_results(self,
                                results: pysolr.Results) -> SearchResults:
        

        # map go-golr fields to standard
        for doc in results.docs:
            if 'entity' in doc:
                doc['id'] = doc['entity']
                doc['label'] = doc['entity_label']

        highlighting = {
            doc['id']: self._process_highlight(results, doc)._asdict()
            for doc in results.docs if results.highlighting
        }
        payload = SearchResults(
            facet_counts=translate_facet_field(results.facets),
            highlighting=highlighting,
            docs=results.docs,
            numFound=results.hits
        )
        logging.debug('Docs: {}'.format(len(results.docs)))

        return payload