Skip to content

Commit

Permalink
Drop legacy full-text search support
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Jan 10, 2024
1 parent d11d42f commit 40da861
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 35 deletions.
10 changes: 0 additions & 10 deletions docs/src/main/sphinx/connector/opensearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,6 @@ The following hidden columns are available:
| \_score | The document score returned by the OpenSearch query |
| \_source | The source of the original document |

(opensearch-full-text-queries)=
## Full text queries

Trino SQL queries can be combined with OpenSearch queries by providing the [full text query]
as part of the table name, separated by a colon. For example:

```sql
SELECT * FROM "tweets: +trino SQL^2"
```

## Predicate push down

The connector supports [predicate push down](predicate-pushdown) for the following data types:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,8 @@ public OpenSearchTableHandle getTableHandle(ConnectorSession session, SchemaTabl
requireNonNull(tableName, "tableName is null");

if (tableName.getSchemaName().equals(schemaName)) {
String[] parts = tableName.getTableName().split(":", 2);
String table = parts[0];
Optional<String> query = Optional.empty();
if (parts.length == 2) {
query = Optional.of(parts[1]);
}

if (client.indexExists(table) && !client.getIndexMetadata(table).getSchema().getFields().isEmpty()) {
return new OpenSearchTableHandle(OpenSearchTableHandle.Type.SCAN, schemaName, table, query);
if (client.indexExists(tableName.getTableName()) && !client.getIndexMetadata(tableName.getTableName()).getSchema().getFields().isEmpty()) {
return new OpenSearchTableHandle(OpenSearchTableHandle.Type.SCAN, schemaName, tableName.getTableName(), Optional.empty());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1468,9 +1468,6 @@ public void testFilters()
.put("ipv6_column", "2001:db8:0:0:1:0:0:1")
.buildOrThrow());

// _score column
assertQuery("SELECT count(*) FROM \"filter_pushdown: cool\" WHERE _score > 0", "VALUES 1");

// boolean
assertQuery("SELECT count(*) FROM filter_pushdown WHERE boolean_column = true", "VALUES 1");
assertQuery("SELECT count(*) FROM filter_pushdown WHERE boolean_column = false", "VALUES 0");
Expand Down Expand Up @@ -1692,12 +1689,6 @@ public void testNestedTypeDataTypesNested()
assertThat(rows.getMaterializedRows()).isEqualTo(expected.getMaterializedRows());
}

@Test
public void testQueryString()
{
assertQuery("SELECT count(*) FROM \"orders: +packages -slyly\"", "VALUES 1639");
}

@Test
public void testMixedCase()
throws IOException
Expand Down Expand Up @@ -1740,13 +1731,6 @@ public void testNumericKeyword()
"VALUES 20");
}

@Test
public void testQueryStringError()
{
assertQueryFails("SELECT orderkey FROM \"orders: ++foo AND\"", "\\QFailed to parse query [ ++foo and]\\E");
assertQueryFails("SELECT count(*) FROM \"orders: ++foo AND\"", "\\QFailed to parse query [ ++foo and]\\E");
}

@Test
public void testAlias()
throws IOException
Expand Down

0 comments on commit 40da861

Please sign in to comment.