/** * Returns the name (<code>{@link #getName()}</code>) of this search index.<p> * * @return the name (<code>{@link #getName()}</code>) of this search index * * @see java.lang.Object#toString() */ @Override public String toString() { return getName(); }
/** * Get the name of the index for the search.<p> * * @return the name of the index for the search */ public String getIndex() { return m_index.getName(); }
/** * Get the name of the index for the search.<p> * * @return the name of the index for the search */ public String getIndex() { return m_index.getName(); }
/** * Returns the name (<code>{@link #getName()}</code>) of this search index.<p> * * @return the name (<code>{@link #getName()}</code>) of this search index * * @see java.lang.Object#toString() */ @Override public String toString() { return getName(); }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if ((obj instanceof CmsSearchIndex)) { return ((CmsSearchIndex)obj).getName().equals(m_name); } return false; }
/** * Returns the Lucene search index configured with the given name.<p> * The index must exist, otherwise <code>null</code> is returned. * * @param indexName then name of the requested search index * * @return the Lucene search index configured with the given name */ public CmsSearchIndex getIndex(String indexName) { for (CmsSearchIndex index : m_indexes) { if (indexName.equalsIgnoreCase(index.getName())) { return index; } } return null; }
/** * Returns the names of all configured indexes.<p> * * @return list of names */ public List<String> getIndexNames() { List<String> indexNames = new ArrayList<String>(); for (int i = 0, n = m_indexes.size(); i < n; i++) { indexNames.add((m_indexes.get(i)).getName()); } return indexNames; }
/** * Returns the names of all configured indexes.<p> * * @return list of names */ public List<String> getIndexNames() { List<String> indexNames = new ArrayList<String>(); for (int i = 0, n = m_indexes.size(); i < n; i++) { indexNames.add((m_indexes.get(i)).getName()); } return indexNames; }
/** * Gets the name of the current search index.<p> * * @return the name of the index */ public String getIndex() { return m_parameters.getSearchIndex().getName(); }
/** * Gets the name of the current search index.<p> * * @return the name of the index */ public String getIndex() { return m_parameters.getSearchIndex().getName(); }
/** * @see org.opencms.search.I_CmsIndexWriter#close() */ public void close() throws IOException { if ((m_index != null) && LOG.isInfoEnabled()) { LOG.info( Messages.get().getBundle().key( Messages.LOG_INDEX_WRITER_MSG_CLOSE_2, m_index.getName(), m_index.getPath())); } m_indexWriter.close(); }
/** * @see org.opencms.search.I_CmsIndexWriter#commit() */ public void commit() throws IOException { if ((m_index != null) && LOG.isInfoEnabled()) { LOG.info( Messages.get().getBundle().key( Messages.LOG_INDEX_WRITER_MSG_COMMIT_2, m_index.getName(), m_index.getPath())); } m_indexWriter.commit(); }
/** * Shuts down the search index.<p> * * This will close the local Lucene index searcher instance.<p> * * @throws IOException in case the index could not be closed */ public void shutDown() throws IOException { if (m_searcher != null) { m_searcher.close(); } if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SHUTDOWN_INDEX_1, getName())); } }
/** * Removes a search index from the configuration.<p> * * @param searchIndex the search index to remove */ public void removeSearchIndex(CmsSearchIndex searchIndex) { m_indexes.remove(searchIndex); initOfflineIndexes(); if (LOG.isInfoEnabled()) { LOG.info(Messages.get().getBundle().key( Messages.LOG_REMOVE_SEARCH_INDEX_2, searchIndex.getName(), searchIndex.getProject())); } }
/** * Logs content extraction for the specified resource and index.<p> * * @param resource the resource to log content extraction for * @param index the search index to log content extraction for */ protected void logContentExtraction(CmsResource resource, CmsSearchIndex index) { if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_EXTRACT_CONTENT_2, resource.getRootPath(), index.getName())); } }
/** * Closes the given Lucene index searcher.<p> * * @param searcher the searcher to close */ protected synchronized void indexSearcherClose(IndexSearcher searcher) { // in case there is an index searcher available close it if ((searcher != null) && (searcher.getIndexReader() != null)) { try { searcher.getIndexReader().close(); } catch (Exception e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_INDEX_SEARCHER_CLOSE_1, getName()), e); } } }
/** * Closes the Lucene index searcher for this index.<p> * * @see #indexSearcherOpen(String) */ protected synchronized void indexSearcherClose() { // in case there is an index searcher available close it if ((m_searcher != null) && (m_searcher.getIndexReader() != null)) { try { m_searcher.getIndexReader().close(); } catch (Exception e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_INDEX_SHUTDOWN_1, getName()), e); } } }
/** * @see org.opencms.search.I_CmsIndexWriter#updateDocument(java.lang.String, org.opencms.search.I_CmsSearchDocument) */ public void updateDocument(String rootPath, I_CmsSearchDocument document) throws IOException { Term pathTerm = new Term(CmsSearchField.FIELD_PATH, rootPath); if ((m_index != null) && LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_INDEX_WRITER_MSG_DOC_UPDATE_3, rootPath, m_index.getName(), m_index.getPath())); } m_indexWriter.updateDocument(pathTerm, (Document)document.getDocument()); } }
/** * Generates the directory on the RFS for this index.<p> * * @return the directory on the RFS for this index */ protected String generateIndexDirectory() { return OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf( OpenCms.getSearchManager().getDirectory() + "/" + getName()); }
/** * @see org.opencms.search.I_CmsIndexWriter#deleteDocument(org.opencms.db.CmsPublishedResource) */ public void deleteDocument(CmsPublishedResource resource) throws IOException { // search for an exact match on the document root path Term term = new Term(CmsSearchField.FIELD_PATH, resource.getRootPath()); if ((m_index != null) && LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_INDEX_WRITER_MSG_DOC_DELETE_3, resource.getRootPath(), m_index.getName(), m_index.getPath())); } m_indexWriter.deleteDocuments(term); }