Пример #1
0
 public void testLeadingWildcardType() throws Exception {
   QueryParserWrapper qp = getParser(null);
   qp.setAllowLeadingWildcard(true);
   assertEquals(WildcardQuery.class, qp.parse("t*erm*").getClass());
   assertEquals(WildcardQuery.class, qp.parse("?term*").getClass());
   assertEquals(WildcardQuery.class, qp.parse("*term*").getClass());
 }
Пример #2
0
 public void assertWildcardQueryEquals(
     String query, boolean lowercase, String result, boolean allowLeadingWildcard)
     throws Exception {
   QueryParserWrapper qp = getParser(null);
   qp.setLowercaseExpandedTerms(lowercase);
   qp.setAllowLeadingWildcard(allowLeadingWildcard);
   Query q = qp.parse(query);
   String s = q.toString("field");
   if (!s.equals(result)) {
     fail("WildcardQuery /" + query + "/ yielded /" + s + "/, expecting /" + result + "/");
   }
 }
Пример #3
0
 public Query getQueryAllowLeadingWildcard(String query, Analyzer a) throws Exception {
   QueryParserWrapper parser = getParser(a);
   parser.setAllowLeadingWildcard(true);
   return parser.parse(query);
 }