|
16 | 16 | import org.testng.annotations.Test;
|
17 | 17 |
|
18 | 18 | import com.google.common.base.Throwables;
|
| 19 | +import com.redis.lettucemod.api.sync.RedisModulesCommands; |
| 20 | +import com.redis.lettucemod.search.CreateOptions; |
| 21 | +import com.redis.lettucemod.search.CreateOptions.DataType; |
| 22 | +import com.redis.lettucemod.search.Field; |
19 | 23 | import com.redis.lettucemod.test.Beers;
|
20 | 24 |
|
21 | 25 | import io.airlift.log.Logger;
|
@@ -109,6 +113,17 @@ public void testNonIndexedFields() throws IOException {
|
109 | 113 | getQueryRunner().execute("select id, last_mod from beers");
|
110 | 114 | }
|
111 | 115 |
|
| 116 | + @SuppressWarnings("unchecked") |
| 117 | + @Test |
| 118 | + public void testJsonSearch() throws IOException { |
| 119 | + RedisModulesCommands<String, String> sync = redisearch.getTestContext().getConnection().sync(); |
| 120 | + sync.ftCreate("jsontest", CreateOptions.<String, String>builder().on(DataType.JSON).build(), |
| 121 | + Field.tag("$.id").as("id").build(), Field.text("$.message").as("message").build()); |
| 122 | + sync.jsonSet("doc:1", "$", "{\"id\": \"1\", \"message\": \"this is a test\"}"); |
| 123 | + sync.jsonSet("doc:2", "$", "{\"id\": \"2\", \"message\": \"this is another test\"}"); |
| 124 | + getQueryRunner().execute("select id, message from jsontest"); |
| 125 | + } |
| 126 | + |
112 | 127 | @Test
|
113 | 128 | public void testHaving() {
|
114 | 129 | throw new SkipException("Not supported by RediSearch connector");
|
|
0 commit comments