use of org.folio.services.util.parser.ParseFieldsResult in project mod-source-record-storage by folio-org.
the class SearchExpressionParserUnitTest method shouldParseFieldsSearchExpression_forDateRangeOperand_NotEqualsOperator.
@Test
public void shouldParseFieldsSearchExpression_forDateRangeOperand_NotEqualsOperator() {
// given
String fieldsSearchExpression = "005.date not= '201701025'";
// when
ParseFieldsResult result = parseFieldsSearchExpression(fieldsSearchExpression);
// then
assertTrue(result.isEnabled());
assertEquals(singletonList("201701025"), result.getBindingParams());
assertEquals(new HashSet<>(singletonList("005")), result.getFieldsToJoin());
assertEquals("to_date(substring(\"i005\".\"value\", 1, 8), 'yyyymmdd') <> ?", result.getWhereExpression());
}
use of org.folio.services.util.parser.ParseFieldsResult in project mod-source-record-storage by folio-org.
the class SearchExpressionParserUnitTest method shouldParseFieldsSearchExpression_for_PositionOperand_NotEqualsOperator.
@Test
public void shouldParseFieldsSearchExpression_for_PositionOperand_NotEqualsOperator() {
// given
String fieldsSearchExpression = "005.00_04 not= '2014'";
// when
ParseFieldsResult result = parseFieldsSearchExpression(fieldsSearchExpression);
// then
assertTrue(result.isEnabled());
assertEquals(singletonList("2014"), result.getBindingParams());
assertEquals(new HashSet<>(singletonList("005")), result.getFieldsToJoin());
assertEquals("substring(\"i005\".\"value\", 1, 4) <> ?", result.getWhereExpression());
}
use of org.folio.services.util.parser.ParseFieldsResult in project mod-source-record-storage by folio-org.
the class SearchExpressionParserUnitTest method shouldParseFieldsSearchExpression_for_SubFieldOperand_NotEqualsOperator.
@Test
public void shouldParseFieldsSearchExpression_for_SubFieldOperand_NotEqualsOperator() {
// given
String fieldsSearchExpression = "035.a not= '(OCoLC)'";
// when
ParseFieldsResult result = parseFieldsSearchExpression(fieldsSearchExpression);
// then
assertTrue(result.isEnabled());
assertEquals(singletonList("(OCoLC)"), result.getBindingParams());
assertEquals(new HashSet<>(singletonList("035")), result.getFieldsToJoin());
assertEquals("(\"i035\".\"subfield_no\" = 'a' and \"i035\".\"value\" <> ?)", result.getWhereExpression());
}
use of org.folio.services.util.parser.ParseFieldsResult in project mod-source-record-storage by folio-org.
the class SearchExpressionParserUnitTest method shouldParseFieldsSearchExpression_for_ValueOperand_LeftAnchoredEqualsOperator.
@Test
public void shouldParseFieldsSearchExpression_for_ValueOperand_LeftAnchoredEqualsOperator() {
// given
String fieldsSearchExpression = "005.value ^= '20141107'";
// when
ParseFieldsResult result = parseFieldsSearchExpression(fieldsSearchExpression);
// then
assertTrue(result.isEnabled());
assertEquals(singletonList("20141107%"), result.getBindingParams());
assertEquals(new HashSet<>(singletonList("005")), result.getFieldsToJoin());
assertEquals("\"i005\".\"value\" like ?", result.getWhereExpression());
}
use of org.folio.services.util.parser.ParseFieldsResult in project mod-source-record-storage by folio-org.
the class SearchExpressionParserUnitTest method shouldParseFieldsSearchExpression_forDateRangeOperand_EqualsOperator.
@Test
public void shouldParseFieldsSearchExpression_forDateRangeOperand_EqualsOperator() {
// given
String fieldsSearchExpression = "005.date = '201701025'";
// when
ParseFieldsResult result = parseFieldsSearchExpression(fieldsSearchExpression);
// then
assertTrue(result.isEnabled());
assertEquals(singletonList("201701025"), result.getBindingParams());
assertEquals(new HashSet<>(singletonList("005")), result.getFieldsToJoin());
assertEquals("to_date(substring(\"i005\".\"value\", 1, 8), 'yyyymmdd') = ?", result.getWhereExpression());
}
Aggregations