Skip to content

Commit

Permalink
test: Added test for AS attribute in RediSearch fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Ruaux committed Jul 22, 2022
1 parent d10cac2 commit c6c4061
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
import org.testng.annotations.Test;

import com.google.common.base.Throwables;
import com.redis.lettucemod.api.sync.RedisModulesCommands;
import com.redis.lettucemod.search.CreateOptions;
import com.redis.lettucemod.search.CreateOptions.DataType;
import com.redis.lettucemod.search.Field;
import com.redis.lettucemod.test.Beers;

import io.airlift.log.Logger;
Expand Down Expand Up @@ -109,6 +113,17 @@ public void testNonIndexedFields() throws IOException {
getQueryRunner().execute("select id, last_mod from beers");
}

@SuppressWarnings("unchecked")
@Test
public void testJsonSearch() throws IOException {
RedisModulesCommands<String, String> sync = redisearch.getTestContext().getConnection().sync();
sync.ftCreate("jsontest", CreateOptions.<String, String>builder().on(DataType.JSON).build(),
Field.tag("$.id").as("id").build(), Field.text("$.message").as("message").build());
sync.jsonSet("doc:1", "$", "{\"id\": \"1\", \"message\": \"this is a test\"}");
sync.jsonSet("doc:2", "$", "{\"id\": \"2\", \"message\": \"this is another test\"}");
getQueryRunner().execute("select id, message from jsontest");
}

@Test
public void testHaving() {
throw new SkipException("Not supported by RediSearch connector");
Expand Down

0 comments on commit c6c4061

Please sign in to comment.