html.append(" <li>\n").append(" ").append("name : ").append(idxSource.getName()).append("\n"); html.append(" </li>"); idxSource.getIndexerClassName()).append("\n"); html.append(" </li>"); List<String> resources = idxSource.getResourcesNames(); Iterator<String> itResources = resources.iterator(); while (itResources.hasNext()) { resources = idxSource.getDocumentTypes(); itResources = resources.iterator(); while (itResources.hasNext()) {
/** * @see org.opencms.workplace.list.A_CmsListDialog#getListItems() */ @Override protected List<CmsListItem> getListItems() { List<CmsListItem> result = new ArrayList<CmsListItem>(); // get content List<CmsSearchIndexSource> sources = searchIndexSources(); Iterator<CmsSearchIndexSource> itSources = sources.iterator(); CmsSearchIndexSource source; while (itSources.hasNext()) { source = itSources.next(); CmsListItem item = getList().newItem(source.getName()); item.set(LIST_COLUMN_NAME, source.getName()); item.set(LIST_COLUMN_INDEXER, source.getIndexer().getClass().getName()); result.add(item); } return result; }
/** * Returns <code>true</code> in case the given resource root path is contained in the list of * configured resource names, and the given document type name is contained in the * list if configured document type names of this index source.<p> * * @param rootPath the resource root path to check * @param documentType the document type factory name to check * * @return <code>true</code> in case the given resource root path is contained in the list of * configured resource names, and the given document type name is contained in the * list if configured document type names of this index source * * @see #isContaining(String) * @see #getDocumentTypes() */ public boolean isIndexing(String rootPath, String documentType) { return m_documentTypes.contains(documentType) && isContaining(rootPath); }
/** * Creates a dummy index source.<p> * * @return the dummy search index source */ private CmsSearchIndexSource createDummyIndexSource() { CmsSearchIndexSource result = new CmsSearchIndexSource(); result.setName("default"); result.setIndexerClassName("org.opencms.search.CmsVfsIndexer"); result.addDocumentType("html"); result.addDocumentType("generic"); result.addDocumentType("pdf"); // add search index source to config: m_searchManager.addSearchIndexSource(result); return result; }
/** * Adds a search index source configuration.<p> * * @param searchIndexSource a search index source configuration */ public void addSearchIndexSource(CmsSearchIndexSource searchIndexSource) { m_indexSources.put(searchIndexSource.getName(), searchIndexSource); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_SEARCH_INDEX_SOURCE_2, searchIndexSource.getName(), searchIndexSource.getIndexerClassName())); } }
/** * Fills details about resource paths of the index source into the given item. <p> * * @param item the list item to fill * @param detailId the id for the detail to fill * */ private void fillDetailResources(CmsListItem item, String detailId) { CmsSearchManager searchManager = OpenCms.getSearchManager(); StringBuffer html = new StringBuffer(); // search for the corresponding CmsSearchIndexSource: String idxSourceName = (String)item.get(LIST_COLUMN_NAME); CmsSearchIndexSource idxSource = searchManager.getIndexSource(idxSourceName); // get the index sources resource strings List<String> resources = idxSource.getResourcesNames(); // output of found index sources Iterator<String> itResources = resources.iterator(); html.append("<ul>\n"); while (itResources.hasNext()) { html.append(" <li>\n").append(" ").append(itResources.next()).append("\n"); html.append(" </li>"); } html.append("</ul>\n"); item.set(detailId, html.toString()); }
m_sources.add(indexSource); resourceNames = indexSource.getResourcesNames(); searchIndexSourceDocumentTypes = indexSource.getDocumentTypes(); for (int j = 0, m = resourceNames.size(); j < m; j++) {
List<String> docTypes = idxSource.getDocumentTypes();
/** * Returns <code>true</code> if at least one of the index sources uses a VFS indexer that is able * to index locale dependent resources.<p> * * TODO This should be improved somehow * * @return <code>true</code> if this field configuration should resolve locale dependencies */ private boolean hasLocaleDependencies() { for (CmsSearchIndexSource source : getIndex().getSources()) { if (source.getIndexer().isLocaleDependenciesEnable()) { return true; } } return false; } }
/** * Checks if the given resource should be indexed by this index or not.<p> * * @param res the resource candidate * * @return <code>true</code> if the given resource should be indexed or <code>false</code> if not */ protected boolean isIndexing(CmsResource res) { if ((res != null) && (getSources() != null)) { I_CmsDocumentFactory result = OpenCms.getSearchManager().getDocumentFactory(res); for (CmsSearchIndexSource source : getSources()) { if (source.isIndexing(res.getRootPath(), CmsSolrDocumentContainerPage.TYPE_CONTAINERPAGE_SOLR) || source.isIndexing(res.getRootPath(), CmsSolrDocumentXmlContent.TYPE_XMLCONTENT_SOLR) || source.isIndexing(res.getRootPath(), result.getName())) { return true; } } } return false; }
/** * Initializes the user object to work with depending on the dialog state and request parameters.<p> * * Two initializations of the user object on first dialog call are possible: * <ul> * <li>edit an existing search index</li> * <li>create a new search index with default initialization</li> * </ul> */ protected void initUserObject() { if (m_indexsource == null) { try { m_indexsource = m_searchManager.getIndexSource(getParamIndexsource()); if (m_indexsource == null) { m_indexsource = new CmsSearchIndexSource(); } } catch (Exception e) { m_indexsource = new CmsSearchIndexSource(); } } }
/** * Fills details about resource paths of the index source into the given item. <p> * * @param item the list item to fill * @param detailId the id for the detail to fill * */ private void fillDetailResources(CmsListItem item, String detailId) { CmsSearchManager searchManager = OpenCms.getSearchManager(); StringBuffer html = new StringBuffer(); // search for the corresponding CmsSearchIndexSource: String idxSourceName = (String)item.get(LIST_COLUMN_NAME); CmsSearchIndexSource idxSource = searchManager.getIndexSource(idxSourceName); // get the index sources resource strings List<String> resources = idxSource.getResourcesNames(); // output of found index sources Iterator<String> itResources = resources.iterator(); html.append("<ul>\n"); while (itResources.hasNext()) { html.append(" <li>\n").append(" ").append(itResources.next()).append("\n"); html.append(" </li>"); } html.append("</ul>\n"); item.set(detailId, html.toString()); }
/** * Adds a search index source configuration.<p> * * @param searchIndexSource a search index source configuration */ public void addSearchIndexSource(CmsSearchIndexSource searchIndexSource) { m_indexSources.put(searchIndexSource.getName(), searchIndexSource); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key( Messages.INIT_SEARCH_INDEX_SOURCE_2, searchIndexSource.getName(), searchIndexSource.getIndexerClassName())); } }
m_sources.add(indexSource); resourceNames = indexSource.getResourcesNames(); searchIndexSourceDocumentTypes = indexSource.getDocumentTypes(); for (int j = 0, m = resourceNames.size(); j < m; j++) {
List<String> docTypes = idxSource.getDocumentTypes();
I_CmsIndexer indexer = source.getIndexer().newInstance(cms, report, index);
while (i.hasNext()) { CmsSearchIndexSource source = i.next(); if (source.isIndexing(res.getRootPath(), result.getName())) {
indexsourceElement.addElement(N_NAME).addText(searchIndexSource.getName()); searchIndexSource.getIndexerClassName()); Map params = searchIndexSource.getParams(); Iterator paramIterator = params.entrySet().iterator(); while (paramIterator.hasNext()) { Iterator resourceIterator = searchIndexSource.getResourcesNames().iterator(); while (resourceIterator.hasNext()) { Iterator doctypesIterator = searchIndexSource.getDocumentTypes().iterator(); while (doctypesIterator.hasNext()) {