Search in sources :

Example 6 with MatchPredicate

use of io.crate.expression.symbol.MatchPredicate in project crate by crate.

the class SelectStatementAnalyzerTest method testSelectWhereSimpleMatchPredicate.

@Test
public void testSelectWhereSimpleMatchPredicate() throws Exception {
    var executor = SQLExecutor.builder(clusterService).addTable(TableDefinitions.USER_TABLE_DEFINITION).build();
    QueriedSelectRelation relation = executor.analyze("select * from users where match (text, 'awesome')");
    assertThat(relation.where(), instanceOf(MatchPredicate.class));
    MatchPredicate query = (MatchPredicate) relation.where();
    assertThat(query.identBoostMap(), hasEntry(isReference("text"), isLiteral(null)));
    assertThat(query.options(), isLiteral(Map.of()));
    assertThat(query.queryTerm(), isLiteral("awesome"));
    assertThat(query.matchType(), is("best_fields"));
}
Also used : MatchPredicate(io.crate.expression.symbol.MatchPredicate) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest) Test(org.junit.Test)

Aggregations

MatchPredicate (io.crate.expression.symbol.MatchPredicate)6 CrateDummyClusterServiceUnitTest (io.crate.test.integration.CrateDummyClusterServiceUnitTest)6 Test (org.junit.Test)6 SelectSymbol (io.crate.expression.symbol.SelectSymbol)2 AliasSymbol (io.crate.expression.symbol.AliasSymbol)1 ParameterSymbol (io.crate.expression.symbol.ParameterSymbol)1 Symbol (io.crate.expression.symbol.Symbol)1