/** * @see org.opencms.jsp.search.controller.I_CmsSearchController#addQueryParts(CmsSolrQuery) */ @Override public void addQueryParts(CmsSolrQuery query) { query.setRows(Integer.valueOf(m_config.getPageSize())); final int start = (m_state.getCurrentPage() - 1) * m_config.getPageSize(); query.setStart(Integer.valueOf(start)); }
/** * @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; }
/** * Public constructor.<p> * * @param cms the current OpenCms context * @param queryParams the Solr query parameters */ public CmsSolrQuery(CmsObject cms, Map<String, String[]> queryParams) { setQuery(DEFAULT_QUERY); setFields(ALL_RETURN_FIELDS); setRequestHandler(DEFAULT_QUERY_TYPE); setRows(DEFAULT_ROWS); // set the values from the request context if (cms != null) { setLocales(Collections.singletonList(cms.getRequestContext().getLocale())); setSearchRoots(Collections.singletonList(cms.getRequestContext().getSiteRoot() + "/")); } if (queryParams != null) { m_queryParameters = queryParams; } ensureParameters(); ensureReturnFields(); ensureExpiration(); }
/** * Adds the content info for the collected resources used in the "This page" publish dialog. */ private void addContentInfo() { if (!m_cms.getRequestContext().getCurrentProject().isOnlineProject() && (null == m_searchController.getCommon().getConfig().getSolrIndex()) && (null != m_addContentInfoForEntries)) { CmsSolrQuery query = new CmsSolrQuery(); m_searchController.addQueryParts(query); query.setStart(Integer.valueOf(0)); query.setRows(m_addContentInfoForEntries); CmsContentLoadCollectorInfo info = new CmsContentLoadCollectorInfo(); info.setCollectorClass(this.getClass().getName()); info.setCollectorParams(query.getQuery()); info.setId((new CmsUUID()).getStringValue()); if (CmsJspTagEditable.getDirectEditProvider(pageContext) != null) { try { CmsJspTagEditable.getDirectEditProvider(pageContext).insertDirectEditListMetadata( pageContext, info); } catch (JspException e) { // TODO: improve + localize error message LOG.error("Could not write content info.", e); } } } }
query.setRows(new Integer(m_matchesPerPage));
query.setResourceTypes(m_settings.getTypesArray()); query.setRows(new Integer(999999999)); query.ensureParameters(); try {
query.setResourceTypes(m_settings.getTypesArray()); query.setRows(new Integer(999999999)); query.ensureParameters(); try {
query.setRows(new Integer((5 * rows * page) + start));