use of org.folio.services.util.parser.ParseFieldsResult in project mod-source-record-storage by folio-org.
the class SearchExpressionParserUnitTest method shouldParseFieldsSearchExpression_for_SubFieldOperand_IsAbsentOperator.
@Test
public void shouldParseFieldsSearchExpression_for_SubFieldOperand_IsAbsentOperator() {
// given
String fieldsSearchExpression = "035.z is 'absent'";
// when
ParseFieldsResult result = parseFieldsSearchExpression(fieldsSearchExpression);
// then
assertTrue(result.isEnabled());
assertEquals(emptyList(), result.getBindingParams());
assertEquals(emptySet(), result.getFieldsToJoin());
assertEquals("(id not in (select marc_id from marc_indexers_035 where subfield_no = 'z')) ", 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_EqualsOperator.
@Test
public void shouldParseFieldsSearchExpression_for_PositionOperand_EqualsOperator() {
// given
String fieldsSearchExpression = "005.00_04 = '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_LeftAnchoredEqualsOperator.
@Test
public void shouldParseFieldsSearchExpression_for_SubFieldOperand_LeftAnchoredEqualsOperator() {
// given
String fieldsSearchExpression = "035.a ^= '(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\" 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_for_IndicatorOperand_IsAbsentOperator.
@Test
public void shouldParseFieldsSearchExpression_for_IndicatorOperand_IsAbsentOperator() {
// given
String fieldsSearchExpression = "050.ind2 is 'absent'";
// when
ParseFieldsResult result = parseFieldsSearchExpression(fieldsSearchExpression);
// then
assertTrue(result.isEnabled());
assertEquals(emptyList(), result.getBindingParams());
assertEquals(emptySet(), result.getFieldsToJoin());
assertEquals("(id in (select marc_id from marc_indexers_050 where ind2 = '#')) ", 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_EqualsOperator.
@Test
public void shouldParseFieldsSearchExpression_for_SubFieldOperand_EqualsOperator() {
// given
String fieldsSearchExpression = "035.a = '(OCoLC)63611770'";
// when
ParseFieldsResult result = parseFieldsSearchExpression(fieldsSearchExpression);
// then
assertTrue(result.isEnabled());
assertEquals(singletonList("(OCoLC)63611770"), result.getBindingParams());
assertEquals(new HashSet<>(singletonList("035")), result.getFieldsToJoin());
assertEquals("(\"i035\".\"subfield_no\" = 'a' and \"i035\".\"value\" = ?)", result.getWhereExpression());
}
Aggregations