protected void change(long nodeId, Object value) throws IOException, IndexCapacityExceededException { Fieldable encodedValue = documentStructure.encodeAsFieldable(value); writer.updateDocument( documentStructure.newQueryForChangeOrRemove(nodeId), documentStructure.newDocumentRepresentingProperty(nodeId, encodedValue)); }
private void addRecovered(long nodeId, Object value) throws IOException, IndexCapacityExceededException { IndexSearcher searcher = searcherManager.acquire(); try { TopDocs hits = searcher.search(new TermQuery(documentStructure.newQueryForChangeOrRemove(nodeId)), 1); if (hits.totalHits > 0) { Fieldable encodedValue = documentStructure.encodeAsFieldable(value); writer.updateDocument( documentStructure.newQueryForChangeOrRemove(nodeId), documentStructure.newDocumentRepresentingProperty(nodeId, encodedValue)); } else { add(nodeId, value); } } finally { searcherManager.release(searcher); } }
protected void remove(long nodeId) throws IOException { writer.deleteDocuments(documentStructure.newQueryForChangeOrRemove(nodeId)); }
protected void add(long nodeId, Object value) throws IOException, IndexCapacityExceededException { Fieldable encodedValue = documentStructure.encodeAsFieldable(value); writer.addDocument(documentStructure.newDocumentRepresentingProperty(nodeId, encodedValue)); }