@Test public void testApplyImplicitAsteriskSearchText_Case3() { DataSearchQueryBuilder uut = new DataSearchQueryBuilder(dsf, userInfoMock); String searchText = "one" + DataSearchQueryBuilder.OR_OPERATOR + "?two" + DataSearchQueryBuilder.OR_OPERATOR + "three"; final String applyImplicitAsteriskSearchText = uut.applyImplicitAsteriskSearchText(searchText); assertEquals("Verify that implicit asterisk NOT applied", searchText, applyImplicitAsteriskSearchText); }
String applyImplicitAsteriskSearchText(final String searchText) { String implicitSearchText = ""; if (searchText.matches(".*[*?\\\\]+.*")) { implicitSearchText = searchText; } else { final Iterable<String> transform = Iterables.transform(Splitter.on(OR_OPERATOR) .omitEmptyStrings() .trimResults() .split(searchText), new Function<String, String>() { @Override public String apply(String input) { return "*".concat(input) .concat("*"); } }); implicitSearchText = Joiner.on(OR_OPERATOR).join(transform); } return implicitSearchText; }
DataSearchQueryBuilder { String applyImplicitAsteriskSearchText(final String searchText) { String implicitSearchText = ""; if (searchText.matches(".*[*?\\\\]+.*")) { implicitSearchText = searchText; } else { final Iterable<String> transform = Iterables.transform(Splitter.on(OR_OPERATOR) .omitEmptyStrings() .trimResults() .split(searchText), new Function<String, String>() { @Override public String apply(String input) { return "*".concat(input) .concat("*"); } }); implicitSearchText = Joiner.on(OR_OPERATOR).join(transform); } return implicitSearchText; } }
DataSearchQueryBuilder { String applyImplicitAsteriskSearchText(final String searchText) { String implicitSearchText = ""; if (searchText.matches(".*[*?\\\\]+.*")) { implicitSearchText = searchText; } else { final Iterable<String> transform = Iterables.transform(Splitter.on(OR_OPERATOR) .omitEmptyStrings() .trimResults() .split(searchText), new Function<String, String>() { @Override public String apply(String input) { return "*".concat(input) .concat("*"); } }); implicitSearchText = Joiner.on(OR_OPERATOR).join(transform); } return implicitSearchText; } DataSearchQueryBuilder(DiskResourceQueryTemplate dsf, UserInfo userinfo); }
DataSearchQueryBuilder { String applyImplicitAsteriskSearchText(final String searchText) { String implicitSearchText = ""; if (searchText.matches(".*[*?\\\\]+.*")) { implicitSearchText = searchText; } else { final Iterable<String> transform = Iterables.transform(Splitter.on(OR_OPERATOR) .omitEmptyStrings() .trimResults() .split(searchText), new Function<String, String>() { @Override public String apply(String input) { return "*".concat(input) .concat("*"); } }); implicitSearchText = Joiner.on(OR_OPERATOR).join(transform); } return implicitSearchText; } DataSearchQueryBuilder(DiskResourceQueryTemplate dsf, UserInfo userinfo); String buildFullQuery(); String taggedWith(); DataSearchQueryBuilder ownedBy(); DataSearchQueryBuilder createdWithin(); DataSearchQueryBuilder file(); DataSearchQueryBuilder fileSizeRange(); String getQuery(); DataSearchQueryBuilder metadataAttribute(); DataSearchQueryBuilder metadataValue(); DataSearchQueryBuilder modifiedWithin(); DataSearchQueryBuilder negatedFile(); DataSearchQueryBuilder sharedWith(); @Override String toString(); Splittable getSimpleQuery(String field, String userEntry); }
DataSearchQueryBuilder { String applyImplicitAsteriskSearchText(final String searchText) { String implicitSearchText = ""; if (searchText.matches(".*[*?\\\\]+.*")) { implicitSearchText = searchText; } else { final Iterable<String> transform = Iterables.transform(Splitter.on(OR_OPERATOR) .omitEmptyStrings() .trimResults() .split(searchText), new Function<String, String>() { @Override public String apply(String input) { return "*".concat(input) .concat("*"); } }); implicitSearchText = Joiner.on(OR_OPERATOR).join(transform); } return implicitSearchText; } DataSearchQueryBuilder(DiskResourceQueryTemplate dsf, UserInfo userinfo); String buildFullQuery(); String taggedWith(); DataSearchQueryBuilder ownedBy(); DataSearchQueryBuilder createdWithin(); DataSearchQueryBuilder file(); DataSearchQueryBuilder fileSizeRange(); String getQuery(); DataSearchQueryBuilder metadataAttribute(); DataSearchQueryBuilder metadataValue(); DataSearchQueryBuilder modifiedWithin(); DataSearchQueryBuilder negatedFile(); DataSearchQueryBuilder sharedWith(); @Override String toString(); Splittable getSimpleQuery(String field, String userEntry); static final String METADATA_VALUE; static final String METADATA_ATTRIBUTE; static final String FIELDS; static final String QUERY_STRING; static final String LESSER; static final String GREATER; static final String RANGE2; static final String WILDCARD; static final String OR_OPERATOR; static final String DATE_MODIFIED; static final String QUERY2; static final String PATH; static final String METADATA2; static final String NESTED2; static final String HAS_CHILD; static final String FILE_SIZE; static final String LABEL; static final String DATE_CREATED; static final String BOOL; }