Boolean operators "OR" and "NOT"

Boolean operators "OR" and "NOT"

Proposed phased approach to add “OR” and “NOT” operators to Lists/Bulk Edit

As of the Trillium release, “AND” is the only Boolean operator supported by the query builder plug-in used in the Lists app/Bulk Edit, and through FQM (FOLIO query machine) APIs. The following proposal adds “OR” and “NOT” as Boolean operators.

  1. Phase 1 - Umbrellaleaf - UXPROD-5178: Lists - Build queries with "NOT" Boolean operatorIn Refinement

    1. Add “NOT” operators to query builder UI without allowing nesting of queries

    2. The user friendly query displays with parenthesis to help the user understand the exact query being executed

    3. Backend support for nesting of queries via FQM

  2. Phase 2 - Vetch (or later)

    1. Provide a way to do a nested query from the UI (most likely in the form of something like Query search in inventory)

  3. Phase 3 - Unscheduled - UXPROD-5616: Lists - Build queries with "OR" Boolean operatorDraft

    1. Add “OR” operator to query builder UI without allowing nesting of queries

    2. AND takes precedence before OR

    3. The user friendly query displays with parenthesis to help the user understand the exact query being executed

    4. Backend support for nesting of queries via FQM

    5. Example mock-up:

image-20250820-132526.png

 

NOT use cases:

Use case title and description

Example query

Can query be achieved with different operators?

Use case provided by

Use case title and description

Example query

Can query be achieved with different operators?

Use case provided by

1

NOT to exclude results (with contains or starts with)

2

I was recently hoping to do OR and NOT searches related to our Auction Catalog holdings. We would use this functionality to inform future collection development (acquisitions and weeding) decisions.

 

Material type – Name = Auction Catalog 

AND

Instances – Resource Title   contains  books

NOT

Instances – Resource Title contains engravings

no

Saint Louis Art Museum

3

Some of the situations where I want a Boolean NOT are addressed with the “in” and “not in” operators. It would be nice to have the “in” and “not in” operators for more data fields. If we had more “not” operator options, would that alleviate the need for NOT as a Boolean? I want “does not start with” and “does not contain” operators. While I have the wish list out, I’d also like “ends with” and “does not end with”

NOT start with

NOT contain

no

Missouri State Library

4

Creating inventory lists for collection management. We want to get call numbers that are only the single letter Subclass, Ex: B and not BC, BD, etc.

Location IN (Clapp Stacks, Clapp Oversize)

AND Holdings -- Call Number starts with B

NOT Holdings -- Call Number starts with BC

NOT Holdings -- Call Number starts with BD

etc

no

We could broadly export the entire B class and use spreadsheets to isolate the B subclass, but if the collection is very large and need lots of data columns exported it can render the file unusable in spreadsheet software because the of the # of cells.

Wellesley College

OR use cases

Use case title and description

Example query

Can query be achieved with different operators?

Use case provided by

Use case title and description

Example query

Can query be achieved with different operators?

Use case provided by

1

OR in combination with contains

2

Address variations

In a similar vein, I’d like to list user records with what are the same address, but entered in different ways.

This would ideally also be combined with other criteria, like status of active.

Government divisions sometimes move to other buildings and we have to update our records for everyone affected. I’d like this flexibility with other address fields as well.

Address 1, Address line 2 contains 301 W High St
OR 301 West Hight Street
OR 301 W High Street
OR 301 West High St

no

Missouri State Library

3

Department name variations (via address)

If Lists or Bulk edit ever allow querying the address fields from user records, I’d like to pull together variations of department names or multiple department names. These are currently in Address 1, Address Line 1.

Ideally, I’d like to be able to combine this with other criteria, like status of active.

Sometimes we need to assemble information for individual agencies or count or edit accounts we have for that agency. I’d like to use this to help populate the department field for our user records.

Address 1, Address Line 1 contains DPS OR Department of Public Safety
OR MONG
OR Missouri National Guard

no

if the departments were in “Department names” field (rather than addresses), the IN operator could be used

Missouri State Library

4

OR in combination with starts with

5

MODOT uses multiple barcode types. They start with RD, ED, or 00. As lists of loan records do not currently allow me to limit based on item location or library, this is the closest approximation I know of. If OR was an option, I could pull all those together in one list. Since AND is currently the only option, I have to run three separate lists. Even if I could OR them together, this is still limited because I often want to add criteria to apply to that set of MODOT barcodes, but I can't nest them, either. (Though a better solution to this scenario might be to allow search criteria based on item location.)

Query loans by:

Barcode starts with RD
OR
Barcode starts with ED
OR
Barcode starts with 00

 

no

Missouri State Library

6

We had 2 missing call numbers in some item records of over 100 items.

Some of our patron barcodes got mixed in this collection so we were not sure if the barcodes began with 2 or 3 on these particular items.

We only needed to find a small number of items, but a case where or would be helpful.

Instance HRID =
AND
Effective Call number is empty
AND
Item barcode starts with 3
OR barcode starts with 2

no

Jefferson College

7

Creating a shelf list based on call number ranges

Effective location = X

AND

Effective call number starts with AB

OR

Effective call number starts with AC

No

EBSCO Training Team

8

Querying a range of instance date 1 values

9

For this example, we would need to use OR because “greater than or equal to” is not present for the instance date

Goal: (location = stacks) AND ((year = 2024) OR (year = 2025) )

Instance date OR use case.png

no

William Woods University

10

OR in place of IN to broaden results

11

We would use OR searching to identify materials in both the Rock 2nd floor Circulating and Rock 2nd floor Oversize locations

We would use OR searching to identify items with either the DVD or Blu-Ray material format

Location = Rock 2nd floor Circulating
OR
Location = Rock 2nd floor Oversize

 

Material = DVD
OR
Material = Blu-Ray

yes

location and material fields both support use of ‘IN’

Location IN (Rock 2nd floor Circulating, Rock 2nd floor Oversize)

 

Material IN (DVD, Blu-Ray)

Rockhurst University

12

I was trying to update expiration date until I had time to do the full query for new students and faculty.  I need OR in order to update the expiration date for both groups.  Otherwise I need to do Bulk Edits

Patron group - Name equals WC Faculty
OR
Patron group - Name equals WC undergraduate

yes

Patron group supports use of ‘IN’

Westminster College

13

Targeting loans by location: MODOT uses multiple barcode types. They start with RD, ED, or 00. As lists of loan records do not currently allow me to limit based on item location or library, this is the closest approximation I know of. If OR was an option, I could pull all those together in one list. Since AND is currently the only option, I have to run three separate lists. Even if I could OR them together, this is still limited because I often want to add criteria to apply to that set of MODOT barcodes, but I can't nest them, either.

Item location at checkout equals X
OR
Item location at checkout equals Y
OR
Item location at checkout equals Z

yes (for location/library)

item location and item library at checkout can both be queried using the IN operator (as of Sunflower) MODFQMMGR-676: Add item effective location at check out to the loan entityClosed

Query loans by:
Item location at checkout IN (X, Y, Z)

Missouri State Library

14

Creating a list of specific instances, holdings, or items based on known identifiers to download information about corresponding records.

Instance HRID equals X

OR

Instance HRID equals X

OR

Instance HRID equals X

 

Holdings HRID equals X

OR

Holdings HRID equals X

OR

Holdings HRID equals X

 

Item barcode equals X

OR

Item barcode equals X

OR

Item barcode equals X

No

EBSCO Training Team

Additional user feedback:

  • OR and NOT would be helpful when searching for things that could be in either of multiple locations, or searching for something in Multiple patron groups, etc. -Jefferson College

  • I have mixed feelings about nesting – it can get complicated, and sometimes it’s safer for me to use a series of lists to whittle the records down to what I want. I grumble about exporting an overbroad set of records to Excel then using its tools to refine the list, but it is (usually) effective. -Missouri State Library

  • I think I’m also looking for a way to run the query on an already limited subset of records. If I have to set up a very complicated single query, I worry that I’ll either miss records I want or include records I don’t. -Missouri State Library

  • In general, if we had OR and NOT available, fewer queries would be needed. Which in turn... Means fewer queries that Scott has to build for us and stop whatever he's doing to build it -Crowder College

Inventory advanced/query search behavior:

  • AND takes precedence before OR

  • the Inventory “Advanced search UI” does not allow nesting of queries

  • the Query search allows for nesting of queries

Inventory UI (“Advanced search” or “Query search”)

Query

Matching records

Inventory UI (“Advanced search” or “Query search”)

Query

Matching records

1
Inventory advanced search.png

 

(dog AND big) OR little

matches:

  • big dog

  • little dog

  • little cat

does not match:

  • big cat

2
Inventory advanced search 2.png

 

(dog AND big) OR (little AND cat)

matches:

  • big dog

  • little cat

does not match:

  • little dog

  • big cat

3
Inventory query search.png

 

dog AND (little OR big)

matches:

  • big dog

  • little dog

does not match:

  • big cat

  • little cat