public static void updateDocuments( String searchEngineId, long companyId, Collection<Document> documents) throws SearchException { if (isIndexReadOnly() || (documents == null) || documents.isEmpty()) { return; } SearchEngine searchEngine = getSearchEngine(searchEngineId); IndexWriter indexWriter = searchEngine.getIndexWriter(); for (Document document : documents) { if (_log.isDebugEnabled()) { _log.debug("Document " + document.toString()); } _searchPermissionChecker.addPermissionFields(companyId, document); } SearchContext searchContext = new SearchContext(); searchContext.setCompanyId(companyId); searchContext.setSearchEngineId(searchEngineId); indexWriter.updateDocuments(searchContext, documents); }
protected void updateDocuments(Term id, List<? extends IndexDocument> docs) throws Exception { writer.updateDocuments(id, docs); }
/** * Calls {@link IndexWriter#updateDocuments(Term,Iterable)} and returns the generation that * reflects this change. */ public long updateDocuments(Term t, Iterable<? extends Iterable<? extends IndexableField>> docs) throws IOException { writer.updateDocuments(t, docs); // Return gen as of when indexing finished: return indexingGen.get(); }