示例#1
0
 protected void change(long nodeId, Object value)
     throws IOException, IndexCapacityExceededException {
   Fieldable encodedValue = documentStructure.encodeAsFieldable(value);
   writer.updateDocument(
       documentStructure.newQueryForChangeOrRemove(nodeId),
       documentStructure.newDocumentRepresentingProperty(nodeId, encodedValue));
 }
示例#2
0
 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);
   }
 }
示例#3
0
 protected void remove(long nodeId) throws IOException {
   writer.deleteDocuments(documentStructure.newQueryForChangeOrRemove(nodeId));
 }
示例#4
0
 protected void add(long nodeId, Object value) throws IOException, IndexCapacityExceededException {
   Fieldable encodedValue = documentStructure.encodeAsFieldable(value);
   writer.addDocument(documentStructure.newDocumentRepresentingProperty(nodeId, encodedValue));
 }