/** * Gets the index to use for queries.<p> * * @return the index to use for queries */ private CmsSolrIndex getIndex() { String indexName = m_indexName; if (indexName == null) { return null; } return OpenCms.getSearchManager().getIndexSolr(indexName); }
/** * Returns all Solr index.<p> * * @return all Solr indexes */ public List<CmsSolrIndex> getAllSolrIndexes() { List<CmsSolrIndex> result = new ArrayList<CmsSolrIndex>(); for (String indexName : getIndexNames()) { CmsSolrIndex index = getIndexSolr(indexName); if (index != null) { result.add(index); } } return result; }
/** * Returns the resource type for the given root path.<p> * * @param cms the current CMS context * @param rootPath the root path of the resource to get the type for * * @return the resource type for the given root path */ public static final String getType(CmsObject cms, String rootPath) { String type = null; CmsSolrIndex index = CmsSearchManager.getIndexSolr(cms, null); if (index != null) { I_CmsSearchDocument doc = index.getDocument(CmsSearchField.FIELD_PATH, rootPath); if (doc != null) { type = doc.getFieldValueAsString(CmsSearchField.FIELD_TYPE); } } return type; }
/** * @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)); }
index = indexName != null ? OpenCms.getSearchManager().getIndexSolr(indexName) : null; if (index == null) {
/** * Returns <code>true</code> if Solr search is enabled.<p> * * @return <code>true</code> if Solr search is enabled */ private boolean isSolrEnabled() { boolean solrEnabled = OpenCms.getSearchManager().getSolrServerConfiguration().isEnabled(); CmsSolrIndex solrIndex = OpenCms.getSearchManager().getIndexSolr(CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE); return solrEnabled && (solrIndex != null); } }
context.m_cms = getCmsObject(req); context.m_params = CmsRequestUtil.createParameterMap(req.getParameterMap()); context.m_index = CmsSearchManager.getIndexSolr(context.m_cms, context.m_params);
throws CmsException { CmsSolrIndex solrOnline = OpenCms.getSearchManager().getIndexSolr(SOLR_ONLINE); CmsSolrIndex solrOffline = OpenCms.getSearchManager().getIndexSolr(SOLR_OFFLINE); Set<CmsResource> result = new HashSet<CmsResource>(); try {
/** * Set the name of the index to search.<p> * * A former search result will be deleted.<p> * * @param indexName the name of the index * * @throws CmsException if the index was not found */ public void setIndex(String indexName) throws CmsException { if (CmsStringUtil.isEmpty(indexName)) { throw new CmsException(Messages.get().container(Messages.ERR_INDEXSOURCE_CREATE_MISSING_NAME_0)); } CmsSolrIndex index = OpenCms.getSearchManager().getIndexSolr(indexName); if (index == null) { throw new CmsException(Messages.get().container(Messages.ERR_INDEX_NOT_FOUND_1, indexName)); } m_index = index; }
m_index = OpenCms.getSearchManager().getIndexSolr(indexName); m_index = OpenCms.getSearchManager().getIndexSolr( m_cms.getRequestContext().getCurrentProject().isOnlineProject() ? SOLR_ONLINE : SOLR_OFFLINE);
CmsSolrIndex index = OpenCms.getSearchManager().getIndexSolr(m_settings.getSource()); if (index != null) { CmsSolrQuery query = new CmsSolrQuery(
CmsSolrIndex index = OpenCms.getSearchManager().getIndexSolr(m_settings.getSource()); if (index != null) { CmsSolrQuery query = new CmsSolrQuery(
? 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);
searchBean.init(searchCms); CmsGallerySearchResultList searchResults = OpenCms.getSearchManager().getIndexSolr( "Solr Offline").gallerySearch(searchCms, params); searchResults.calculatePages(params.getResultPage(), params.getMatchesPerPage());