From 7f15ec2fa734f222026f8f9746530a7f568ff796 Mon Sep 17 00:00:00 2001 From: Silvan Heller Date: Thu, 11 Aug 2022 15:50:02 +0200 Subject: [PATCH] Preventing unnecessary data being sent for text queries (#335) --- .../cineast/core/db/cottontaildb/CottontailSelector.java | 2 +- .../vitrivr/cineast/core/db/DBBooleanIntegrationTest.java | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cineast-core/src/main/java/org/vitrivr/cineast/core/db/cottontaildb/CottontailSelector.java b/cineast-core/src/main/java/org/vitrivr/cineast/core/db/cottontaildb/CottontailSelector.java index 1482c0025..a91f27384 100644 --- a/cineast-core/src/main/java/org/vitrivr/cineast/core/db/cottontaildb/CottontailSelector.java +++ b/cineast-core/src/main/java/org/vitrivr/cineast/core/db/cottontaildb/CottontailSelector.java @@ -346,7 +346,7 @@ public List> getFulltextRows(int rows, String /* TODO Cottontail calls this a distance in its documentation, but it's actually a score. See the tests - that's why we order DESC and not ASC */ final Query query = new Query(this.fqn) - .select("*", null) + .select("id", null) .fulltext(fieldname, predicate, DB_DISTANCE_VALUE_QUALIFIER) .queryId(generateQueryID("ft-rows", queryConfig)) .order(DB_DISTANCE_VALUE_QUALIFIER, Direction.DESC) diff --git a/cineast-core/src/test/java/org/vitrivr/cineast/core/db/DBBooleanIntegrationTest.java b/cineast-core/src/test/java/org/vitrivr/cineast/core/db/DBBooleanIntegrationTest.java index 46f508de0..7cabf01d6 100644 --- a/cineast-core/src/test/java/org/vitrivr/cineast/core/db/DBBooleanIntegrationTest.java +++ b/cineast-core/src/test/java/org/vitrivr/cineast/core/db/DBBooleanIntegrationTest.java @@ -63,7 +63,7 @@ public abstract class DBBooleanIntegrationTest { @BeforeAll void checkConnection() { provider = provider(); - assumeTrue(provider!=null); + assumeTrue(provider != null); selector = provider.getSelector(); LOGGER.info("Trying to establish connection to Database"); assumeTrue(selector.ping(), "Connection to database could not be established"); @@ -76,7 +76,7 @@ void checkConnection() { @BeforeEach void setupTest() { - assumeTrue(provider!=null); + assumeTrue(provider != null); dropTables(); createTables(); fillData(); @@ -168,9 +168,7 @@ public void testFulltextQuery() { this.selector.open(testTableName); int idToCheck = TABLE_CARD - 1; final List> result = selector.getFulltextRows(1, DATA_COL_NAME_1, queryConfig, "string-data-" + idToCheck); - Assertions.assertEquals(result.get(0).get(DATA_COL_NAME_1).getString(), "string-data-" + idToCheck); - Assertions.assertEquals(result.get(0).get(DATA_COL_NAME_2).getInt(), -idToCheck); - Assertions.assertEquals(result.get(0).get(DATA_COL_NAME_3).getInt(), (idToCheck + TABLE_CARD)); + Assertions.assertEquals(result.get(0).get(ID_COL_NAME).getInt(), idToCheck); } @Test