public static void addDocuments( 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("Add document " + document.toString()); } _searchPermissionChecker.addPermissionFields(companyId, document); } SearchContext searchContext = new SearchContext(); searchContext.setCompanyId(companyId); searchContext.setSearchEngineId(searchEngineId); indexWriter.addDocuments(searchContext, documents); }
protected void addDocuments(Term id, List<? extends IndexDocument> docs) throws Exception { writer.addDocuments(docs); }
/** * Calls {@link IndexWriter#addDocuments(Iterable)} and returns the generation that reflects this * change. */ public long addDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs) throws IOException { writer.addDocuments(docs); // Return gen as of when indexing finished: return indexingGen.get(); }