You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2023/01/01 22:54:21 UTC

[couchdb] 04/05: reorder for readability

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch import-nouveau-reorg
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit fb11df7810a5650d6dac017cdb8ec4fad652e033
Author: Robert Newson <rn...@apache.org>
AuthorDate: Sun Jan 1 20:04:12 2023 +0000

    reorder for readability
---
 .../apache/couchdb/nouveau/core/Lucene9Index.java  | 38 +++++++++++-----------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/Lucene9Index.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/Lucene9Index.java
index d62beff9b..fe86092d4 100644
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/Lucene9Index.java
+++ b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/Lucene9Index.java
@@ -115,6 +115,25 @@ class Lucene9Index extends Index {
         writer.deleteDocuments(query);
     }
 
+    @Override
+    public boolean doCommit(final long updateSeq) throws IOException {
+        writer.setLiveCommitData(Collections.singletonMap("update_seq", Long.toString(updateSeq)).entrySet());
+        return writer.commit() != -1;
+    }
+
+    @Override
+    public void doClose(final boolean deleteOnClose) throws IOException {
+        if (deleteOnClose) {
+            // No need to commit in this case.
+            writer.rollback();
+            final Directory dir = writer.getDirectory();
+            for (final String name : dir.listAll()) {
+                dir.deleteFile(name);
+            }
+        }
+        writer.close();
+    }
+
     @Override
     public SearchResults doSearch(final SearchRequest request) throws IOException, QueryParserException {
         final Query query = newQueryParser().parse(request);
@@ -273,25 +292,6 @@ class Lucene9Index extends Index {
         return new SortField(m.group(2), type, reverse);
     }
 
-    @Override
-    public boolean doCommit(final long updateSeq) throws IOException {
-        writer.setLiveCommitData(Collections.singletonMap("update_seq", Long.toString(updateSeq)).entrySet());
-        return writer.commit() != -1;
-    }
-
-    @Override
-    public void doClose(final boolean deleteOnClose) throws IOException {
-        if (deleteOnClose) {
-            // No need to commit in this case.
-            writer.rollback();
-            final Directory dir = writer.getDirectory();
-            for (final String name : dir.listAll()) {
-                dir.deleteFile(name);
-            }
-        }
-        writer.close();
-    }
-
     private static Document toDocument(final String docId, final DocumentUpdateRequest request) throws IOException {
         final Document result = new Document();