QueryMatcher implements Serializable { public boolean matches(String... queryTerms) { for (String queryTerm : queryTerms) { for (String entityTerm : entityTerms) { if (entityTerm.contains(queryTerm.toUpperCase())) { return true; } } } return false; } QueryMatcher(final String... theEntityTerms); boolean matches(String... queryTerms);  }
@Test public void test() { QueryMatcher matcher = new QueryMatcher("Jair Bolsonaro", "PP"); boolean result = matcher.matches("bolsonaro"); Assert.assertTrue(result); }