Skip to content

Commit

Permalink
Preventing unnecessary data being sent for text queries (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanheller authored Aug 11, 2022
1 parent c24a49e commit 7f15ec2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public List<Map<String, PrimitiveTypeProvider>> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public abstract class DBBooleanIntegrationTest<R> {
@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");
Expand All @@ -76,7 +76,7 @@ void checkConnection() {

@BeforeEach
void setupTest() {
assumeTrue(provider!=null);
assumeTrue(provider != null);
dropTables();
createTables();
fillData();
Expand Down Expand Up @@ -168,9 +168,7 @@ public void testFulltextQuery() {
this.selector.open(testTableName);
int idToCheck = TABLE_CARD - 1;
final List<Map<String, PrimitiveTypeProvider>> 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
Expand Down

0 comments on commit 7f15ec2

Please sign in to comment.