コード例 #1
0
 public void testToQueryRegExpQuery() throws Exception {
   assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0);
   Query query =
       queryStringQuery("/foo*bar/")
           .defaultField(STRING_FIELD_NAME)
           .maxDeterminizedStates(5000)
           .toQuery(createShardContext());
   assertThat(query, instanceOf(RegexpQuery.class));
   RegexpQuery regexpQuery = (RegexpQuery) query;
   assertTrue(regexpQuery.toString().contains("/foo*bar/"));
 }