From 80fe126a86a610466bdc4089f10e17fd3e683d44 Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Tue, 18 May 2010 11:29:55 +0200 Subject: [PATCH] Add ResultSet#sort --- src/main/java/org/yaz4j/ResultSet.java | 6 ++++++ src/test/org/yaz4j/ConnectionTest.java | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/org/yaz4j/ResultSet.java b/src/main/java/org/yaz4j/ResultSet.java index 766b998..aef52f6 100644 --- a/src/main/java/org/yaz4j/ResultSet.java +++ b/src/main/java/org/yaz4j/ResultSet.java @@ -104,6 +104,12 @@ public class ResultSet implements Iterable { }; } + public ResultSet sort(String type, String spec) throws ZoomException { + int ret = yaz4jlib.ZOOM_resultset_sort1(resultSet, type, spec); + if (ret != 0) throw new ZoomException("Sorting resultset failed"); + return this; + } + public long getHitCount() { return size; } diff --git a/src/test/org/yaz4j/ConnectionTest.java b/src/test/org/yaz4j/ConnectionTest.java index e577707..ca3d01c 100644 --- a/src/test/org/yaz4j/ConnectionTest.java +++ b/src/test/org/yaz4j/ConnectionTest.java @@ -35,6 +35,8 @@ public class ConnectionTest { System.out.println("Got "+i+" record of type "+r.getSyntax()); i++; } + System.out.println("Try sorting them..."); + s.sort("yaz", "1=4 >i 1=21 >s"); } catch (ZoomException ze) { fail(ze.getMessage()); } finally { -- 1.7.10.4