@Override public Editor getIndexEditor(@NotNull String type, @NotNull NodeBuilder definition, @NotNull NodeState root, @NotNull IndexUpdateCallback callback) { IndexingContext context = ((ContextAwareCallback)callback).getIndexingContext(); if (indexPathToFail != null && indexPathToFail.equals(context.getIndexPath())){ RuntimeException e = new RuntimeException(); context.indexUpdateFailed(e); throw e; } return super.getIndexEditor(type, definition, root, callback); }
private boolean addOrUpdate(String path, NodeState state, boolean isUpdate) throws CommitFailedException { try { D d = makeDocument(path, state, isUpdate); if (d != null) { if (log.isTraceEnabled()) { log.trace("[{}] Indexed document for {} is {}", getIndexName(), path, d); } context.indexUpdate(); context.getWriter().updateDocument(path, d); return true; } } catch (IOException e) { CommitFailedException ce = new CommitFailedException("Fulltext", 3, "Failed to index the node " + path, e); context.getIndexingContext().indexUpdateFailed(ce); throw ce; } catch (IllegalArgumentException ie) { log.warn("Failed to index the node [{}]", path, ie); } return false; }
private boolean addOrUpdate(String path, NodeState state, boolean isUpdate) throws CommitFailedException { try { Document d = makeDocument(path, state, isUpdate); if (d != null) { if (log.isTraceEnabled()) { log.trace("[{}] Indexed document for {} is {}", getIndexName(), path, d); } context.indexUpdate(); context.getWriter().updateDocument(path, d); return true; } } catch (IOException e) { CommitFailedException ce = new CommitFailedException("Lucene", 3, "Failed to index the node " + path, e); context.getIndexingContext().indexUpdateFailed(ce); throw ce; } catch (IllegalArgumentException ie) { log.warn("Failed to index the node [{}]", path, ie); } return false; }
private boolean addOrUpdate(String path, NodeState state, boolean isUpdate) throws CommitFailedException { try { Document d = makeDocument(path, state, isUpdate); if (d != null) { if (log.isTraceEnabled()) { log.trace("[{}] Indexed document for {} is {}", getIndexName(), path, d); } context.indexUpdate(); context.getWriter().updateDocument(path, d); return true; } } catch (IOException e) { CommitFailedException ce = new CommitFailedException("Lucene", 3, "Failed to index the node " + path, e); context.getIndexingContext().indexUpdateFailed(ce); throw ce; } catch (IllegalArgumentException ie) { log.warn("Failed to index the node [{}]", path, ie); } return false; }
CommitFailedException ce = new CommitFailedException("Fulltext", 4, "Failed to close the Fulltext index " + context.getIndexingContext().getIndexPath(), e); context.getIndexingContext().indexUpdateFailed(ce); throw ce;
CommitFailedException ce = new CommitFailedException("Lucene", 4, "Failed to close the Lucene index " + context.getIndexingContext().getIndexPath(), e); context.getIndexingContext().indexUpdateFailed(ce); throw ce;
CommitFailedException ce = new CommitFailedException("Lucene", 4, "Failed to close the Lucene index " + context.getIndexingContext().getIndexPath(), e); context.getIndexingContext().indexUpdateFailed(ce); throw ce;
@Override public Editor childNodeDeleted(String name, NodeState before) throws CommitFailedException { PathFilter.Result filterResult = getPathFilterResult(name); if (filterResult == PathFilter.Result.EXCLUDE) { return null; } if (!isDeleted) { // tree deletion is handled on the parent node String path = concat(getPath(), name); try { FulltextIndexWriter writer = context.getWriter(); // Remove all index entries in the removed subtree writer.deleteDocuments(path); this.context.indexUpdate(); } catch (IOException e) { CommitFailedException ce = new CommitFailedException("Fulltext", 5, "Failed to remove the index entries of" + " the removed subtree " + path + "for index " + context.getIndexingContext().getIndexPath(), e); context.getIndexingContext().indexUpdateFailed(ce); throw ce; } } MatcherState ms = getMatcherState(name, before); if (!ms.isEmpty()){ return new FulltextIndexEditor<>(this, name, ms, filterResult, true); } return null; // no need to recurse down the removed subtree }
@Override public Editor childNodeDeleted(String name, NodeState before) throws CommitFailedException { PathFilter.Result filterResult = getPathFilterResult(name); if (filterResult == PathFilter.Result.EXCLUDE) { return null; } if (!isDeleted) { // tree deletion is handled on the parent node String path = concat(getPath(), name); try { LuceneIndexWriter writer = context.getWriter(); // Remove all index entries in the removed subtree writer.deleteDocuments(path); this.context.indexUpdate(); } catch (IOException e) { CommitFailedException ce = new CommitFailedException("Lucene", 5, "Failed to remove the index entries of" + " the removed subtree " + path + "for index " + context.getIndexingContext().getIndexPath(), e); context.getIndexingContext().indexUpdateFailed(ce); throw ce; } } MatcherState ms = getMatcherState(name, before); if (!ms.isEmpty()){ return new LuceneIndexEditor(this, name, ms, filterResult, true); } return null; // no need to recurse down the removed subtree }
@Override public Editor childNodeDeleted(String name, NodeState before) throws CommitFailedException { PathFilter.Result filterResult = getPathFilterResult(name); if (filterResult == PathFilter.Result.EXCLUDE) { return null; } if (!isDeleted) { // tree deletion is handled on the parent node String path = concat(getPath(), name); try { LuceneIndexWriter writer = context.getWriter(); // Remove all index entries in the removed subtree writer.deleteDocuments(path); this.context.indexUpdate(); } catch (IOException e) { CommitFailedException ce = new CommitFailedException("Lucene", 5, "Failed to remove the index entries of" + " the removed subtree " + path + "for index " + context.getIndexingContext().getIndexPath(), e); context.getIndexingContext().indexUpdateFailed(ce); throw ce; } } MatcherState ms = getMatcherState(name, before); if (!ms.isEmpty()){ return new LuceneIndexEditor(this, name, ms, filterResult, true); } return null; // no need to recurse down the removed subtree }