/** * @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)); }
/** * 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; }
/** * 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.setStart(new Integer((m_resultPage - 1) * m_matchesPerPage));
query.setStart(new Integer(0)); query.setRows(new Integer((5 * rows * page) + start));