@Test public void testCheckSpecialSearch() throws Exception { assertNull(ComplexSearchUtils.checkSpecialSearch("a", new char[]{'#'})); assertNull(ComplexSearchUtils.checkSpecialSearch("abc", new char[]{'#'})); assertNull(ComplexSearchUtils.checkSpecialSearch("#", new char[]{'#'})); Pair<String, String> search; search = ComplexSearchUtils.checkSpecialSearch("#tag", new char[]{'#'}); assertNotNull(search); assertEquals("#", search.getFirst()); assertEquals("tag", search.getSecond()); search = ComplexSearchUtils.checkSpecialSearch("# tag ", new char[]{'#'}); assertNotNull(search); assertEquals("#", search.getFirst()); assertEquals("tag", search.getSecond()); search = ComplexSearchUtils.checkSpecialSearch("?phrase", new char[]{'#', '?'}); assertNotNull(search); assertEquals("?", search.getFirst()); assertEquals("phrase", search.getSecond()); search = ComplexSearchUtils.checkSpecialSearch("? phrase ", new char[]{'#', '?'}); assertNotNull(search); assertEquals("?", search.getFirst()); assertEquals("phrase", search.getSecond()); }
public static Pair<String, String> checkSpecialSearch(String filter, char[] binarySortedPrefixes) { if (filter.length() > 1 && Arrays.binarySearch(binarySortedPrefixes, filter.charAt(0)) >= 0) { return new Pair<>(filter.substring(0, 1), filter.substring(1).trim()); } return null; }
ComplexSearchUtils { public static Pair<String, String> checkSpecialSearch(String filter, char[] binarySortedPrefixes) { if (filter.length() > 1 && Arrays.binarySearch(binarySortedPrefixes, filter.charAt(0)) >= 0) { return new Pair<>(filter.substring(0, 1), filter.substring(1).trim()); } return null; } }
ComplexSearchUtils { public static Pair<String, String> checkSpecialSearch(String filter, char[] binarySortedPrefixes) { if (filter.length() > 1 && Arrays.binarySearch(binarySortedPrefixes, filter.charAt(0)) >= 0) { return new Pair<>(filter.substring(0, 1), filter.substring(1).trim()); } return null; } private  ComplexSearchUtils(); }
ComplexSearchUtils { public static Pair<String, String> checkSpecialSearch(String filter, char[] binarySortedPrefixes) { if (filter.length() > 1 && Arrays.binarySearch(binarySortedPrefixes, filter.charAt(0)) >= 0) { return new Pair<>(filter.substring(0, 1), filter.substring(1).trim()); } return null; } private  ComplexSearchUtils(); static Pair<String, String> checkSpecialSearch(String filter, char[] binarySortedPrefixes); static Pair<String, BigDecimal> checkNumericSearch(String filter, char[] binarySortedPrefixes, int precision); static Pair<LocalDateTime, LocalDateTime> checkDateRangeSearch(String filter); }
ComplexSearchUtils { public static Pair<String, String> checkSpecialSearch(String filter, char[] binarySortedPrefixes) { if (filter.length() > 1 && Arrays.binarySearch(binarySortedPrefixes, filter.charAt(0)) >= 0) { return new Pair<>(filter.substring(0, 1), filter.substring(1).trim()); } return null; } private  ComplexSearchUtils(); static Pair<String, String> checkSpecialSearch(String filter, char[] binarySortedPrefixes); static Pair<String, BigDecimal> checkNumericSearch(String filter, char[] binarySortedPrefixes, int precision); static Pair<LocalDateTime, LocalDateTime> checkDateRangeSearch(String filter);  }