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.
Phase 1 - Umbrellaleaf -
UXPROD-5178: Lists - Build queries with "NOT" Boolean operatorIn Refinement
Add “NOT” operators to query builder UI without allowing nesting of queries
The user friendly query displays with parenthesis to help the user understand the exact query being executed
Backend support for nesting of queries via FQM
Phase 2 - Vetch (or later)
Provide a way to do a nested query from the UI (most likely in the form of something like Query search in inventory)
Phase 3 - Unscheduled -
UXPROD-5616: Lists - Build queries with "OR" Boolean operatorDraft
Add “OR” operator to query builder UI without allowing nesting of queries
AND takes precedence before OR
The user friendly query displays with parenthesis to help the user understand the exact query being executed
Backend support for nesting of queries via FQM
Example mock-up:
NOT use cases:
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 | |
|---|---|---|---|---|
| 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 | 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 | 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
| 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 = | 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) ) | 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
Material = DVD | 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 | 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 | yes (for location/library) item location and item library at checkout can both be queried using the IN operator (as of Sunflower) Query loans by: | 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 | |
|---|---|---|---|
| 1 |
| (dog AND big) OR little | matches:
does not match:
|
| 2 |
| (dog AND big) OR (little AND cat) | matches:
does not match:
|
| 3 |
| dog AND (little OR big) | matches:
does not match:
|