/** * Default search method.<p> * * @param cms the current CMS object * @param query the query * * @return the results * * @throws CmsSearchException if something goes wrong * * @see #search(CmsObject, String) */ public CmsSolrResultList search(CmsObject cms, CmsSolrQuery query) throws CmsSearchException { return search(cms, query, false); }
/** * Like {@link #search(CmsObject, CmsSolrQuery, boolean)}, but additionally a resource filter can be specified. * By default, the filter depends on the index. * * @param cms the current OpenCms context * @param ignoreMaxRows <code>true</code> to return all all requested rows, <code>false</code> to use max rows * @param query the OpenCms Solr query * @param filter the resource filter to use for post-processing. * * @return the list of documents found. * * @throws CmsSearchException if something goes wrong */ public CmsSolrResultList search( CmsObject cms, final CmsSolrQuery query, boolean ignoreMaxRows, final CmsResourceFilter filter) throws CmsSearchException { return search(cms, query, ignoreMaxRows, null, false, filter); }
throws CmsSearchException { return search(cms, query, ignoreMaxRows, null, false, null);
/** * Performs a search.<p> * * @param cms the cms object * @param solrQuery the Solr query * * @return a list of documents * * @throws CmsSearchException if something goes wrong * * @see #search(CmsObject, CmsSolrQuery, boolean) */ public CmsSolrResultList search(CmsObject cms, String solrQuery) throws CmsSearchException { return search(cms, new CmsSolrQuery(null, CmsRequestUtil.createParameterMap(solrQuery)), false); }
/** * Default search method.<p> * * @param cms the current CMS object * @param query the query * * @return the results * * @throws CmsSearchException if something goes wrong * * @see #search(CmsObject, String) */ public CmsSolrResultList search(CmsObject cms, SolrQuery query) throws CmsSearchException { return search(cms, CmsEncoder.decode(query.toString())); }
/** * @see org.opencms.file.collectors.I_CmsResourceCollector#getResults(org.opencms.file.CmsObject, java.lang.String, java.lang.String) */ public List<CmsResource> getResults(CmsObject cms, String name, String param, int numResults) throws CmsException { name = name == null ? COLLECTORS[1] : name; Map<String, String> paramsAsMap = getParamsAsMap(param); Map<String, String[]> pm = CmsRequestUtil.createParameterMap( paramsAsMap.get(SOLR_PART), Boolean.valueOf(paramsAsMap.get(PARAM_DECODE_URL)).booleanValue(), cms.getRequestContext().getEncoding()); CmsSolrQuery q = COLLECTORS_LIST.indexOf(name) == 0 ? new CmsSolrQuery(null, pm) : new CmsSolrQuery(cms, pm); boolean excludeTimerange = Boolean.valueOf( paramsAsMap.get(CmsCollectorData.PARAM_EXCLUDETIMERANGE)).booleanValue(); if (excludeTimerange) { q.removeExpiration(); } if (numResults > 0) { q.setRows(Integer.valueOf(numResults)); } CmsSolrIndex index = CmsSearchManager.getIndexSolr(cms, pm); return new ArrayList<CmsResource>(index.search(cms, q, true)); }
/** * Helper method for executing a query.<p> * * @param cms the CMS context to use * @param index the index to use for the query * @param query the query to perform * @param start the start offset * @param rows the number of results to return * * @return the list of search results * @throws CmsSearchException if something goes wrong */ CmsSolrResultList solrSearch(CmsObject cms, CmsSolrIndex index, String query, int start, int rows) throws CmsSearchException { CmsSolrQuery q = new CmsSolrQuery(null, CmsRequestUtil.createParameterMap(query)); q.setStart(new Integer(start)); q.setRows(new Integer(rows)); CmsSolrResultList resultPage = index.search(cms, q, true); return resultPage; }
/** * Writes the response into the writer.<p> * * NOTE: Currently not available for HTTP server.<p> * * @param response the servlet response * @param cms the CMS object to use for search * @param query the Solr query * @param ignoreMaxRows if to return unlimited results * * @throws Exception if there is no embedded server */ public void select(ServletResponse response, CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows) throws Exception { boolean isOnline = cms.getRequestContext().getCurrentProject().isOnlineProject(); CmsResourceFilter filter = isOnline ? null : CmsResourceFilter.IGNORE_EXPIRATION; search(cms, query, ignoreMaxRows, response, false, filter); }
CmsSolrResultList list = search( cms, params.getQuery(cms),
CmsSolrResultList offlineResults = solrOffline.search( CmsPublishListHelper.adjustCmsObject(cms, false), new CmsSolrQuery(null, CmsRequestUtil.createParameterMap(info.getCollectorParams())), CmsSolrResultList onlineResults = solrOnline.search( CmsPublishListHelper.adjustCmsObject(cms, true), new CmsSolrQuery(null, CmsRequestUtil.createParameterMap(info.getCollectorParams())),
CmsSolrResultList solrResultList = m_index.search( m_cms, query,
query.ensureParameters(); try { resources.addAll(index.search(getCms(), query, true)); } catch (CmsSearchException e) { LOG.error(e.getMessage(), e);
query.ensureParameters(); try { resources.addAll(index.search(cmsObject, query, true)); } catch (CmsSearchException e) { LOG.error(e.getMessage(), e);
? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE : CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE; results = OpenCms.getSearchManager().getIndexSolr(indexName).search(cms, query, true, null, true, null); } catch (CmsSearchException e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_BUNDLE_DESCRIPTOR_SEARCH_ERROR_0), e);