@Test public void QueryElement() throws Exception { Query query1 = serializer.toQuery(author.like("Michael"), metadata); Query query2 = serializer.toQuery(text.like("Text"), metadata); BooleanExpression query = Expressions.anyOf(new QueryElement(query1), new QueryElement(query2)); testQuery(query, "author:michael text:text", 1); }
@Test public void Like_Empty_String() throws Exception { testQuery(title.like(""), "title:", 0); }
@Test public void Like_not_Does_Not_Find_Results() throws Exception { testQuery(title.like("*H*e*").not(), "-title:*h*e* +*:*", 1); }
@Test public void Like_and_like() throws Exception { testQuery(title.like("*assic*").and(rating.like("G?od")), "+title:*assic* +rating:g?od", 1); }
@Test public void Like_or_like() throws Exception { testQuery(title.like("House").or(author.like("*ichae*")), "title:house author:*ichae*", 1); }
@Test public void Like_Phrase() throws Exception { testQuery(title.like("*rassic Par*"), "+title:**rassic* +title:*par**", 1); }
@Test public void Like_Custom_Wildcard_Multiple_Character() throws Exception { testQuery(text.like("*U*X*"), "text:*u*x*", 1); }
@Test public void Like_Custom_Wildcard_Single_Character() throws Exception { testQuery(author.like("Mi?hael"), "author:mi?hael", 1); }
@Test public void Like() throws Exception { testQuery(author.like("*ichael*"), "author:*ichael*", 1); }