Constructing a Query Search, using CQL
- In FOLIO, enter the Inventory app
- Click on the record type you wish to search: Instance, Holdings, or Item
- Click on the search type drop-down and select “Query search”
- Type your query in the format:
search field operator “value”
- You can enter multiple queries through the use of Boolean operators:
search field operator “value” and search field operator “value”
- Click Search
For a list of Search Fields, see below
Operators
The operators used in a query are dependent on whether the search fields are full text or term (with some overlap between the two).
Full text: Any free text field (a.k.a. variable field in MARC)
title any “semantic web”
Term: Predefined fields, numeric fields, date fields, some free text fields
metadata.updatedDate > "2020-12-12"
Full Text Operators
Operator |
Example |
Result |
any |
title any “semantic web” |
Matches records with either “semantic” or “web” in any title field |
all |
title all “semantic web” |
Matches records with both “semantic” and “web” in any title field (including different fields), in any order, not necessarily adjacent (e.g., “semantic computer web”) |
= |
title = "semantic web" |
Works the same as all |
== |
title == "semantic web" |
Matches records with both “semantic” and “web” in a title field, in that order, not necessary adjacent (e.g. “semantic computer web”) |
== with a string modifier |
title ==/string "semantic web" |
Matches records with the phrase “semantic web” in a title field |
<> |
title <> "semantic web" |
Matches records with neither “semantic” nor “web” in a title field |
|
title = "mode* europe*" |
Allows for wildcards in search terms (i.e., would match both any word beginning with “mode” and any word beginning with “Europe” in any title field) |
Term Operators
Operator |
Example |
Result |
= |
hrid = “mobiusin000001” |
Exact match |
== |
hrid == “mobiusin000001” |
Exact match |
<> |
hrid <> “mobiusin000001” |
Does not match |
< |
metadata.createdDate < “2024-10-31” |
Created date is before 10/31/2024 (not inclusive) |
<= |
metadata.createdDate <= “2024-10-31” |
Created date is on or before 10/31/2024 (i.e., inclusive) |
> |
metadata.updatedDate > “2024-10-31” |
Updated date is after 10/31/2024 (not inclusive) |
>= |
metadata.updatedDate >= “2024-10-31” |
Updated date is on or after 10/31/2024 (i.e., inclusive) |
|
hrid == “mobiusin*” |
Allows for wildcards in search terms |
Operator Spacing
The operators any and all require space characters before and after the operator:
title all “semantic web”
The operators =, ==, <>, <, <=, >, >= do not require spaces, but do not object to them either:
hrid==”mobiusin*”
hrid == “mobiusin*”
This documentation will show these operators with and without spaces. Both will work.
Boolean Operators
Boolean operators are used to combine queries
Operator |
Definition |
Sample Query |
Result |
and |
Combines criteria to limit results |
contributors all "Mary" and contributors all "John" |
Retrieves records with both the values ”Mary” and “John” in a contributor field |
or |
Combines criteria to expand results |
contributors all "Mary" or contributors all "John" |
Retrieves records with the value ”Mary” in a contributor field plus records with the value “John” in a contributor field |
not |
Combines criteria to exclude data |
contributors all "Mary" not contributors all "John" |
Retrieves records with the value “Mary” in a contributor field minus records with a value “John” in a contributor field |
Boolean Operator “not”
To exclude a set of data from a query, you can use cql.allRecords=1 which retrieves all records in the database, combined with a not Boolean operator:
cql.allRecords=1 NOT contributors=Smith
(Retrieves all records in the database that do not have the value “Smith” in a contributor field.)
Empty or Undefined Values
A defined value is one that is present, i.e., the field is there and has a value. An empty value is a define value that is “blank”. An undefined value isn’t present at all.
For example, item notes are added to Item records. If there is no item note added, the Item Note field is undefined. If an item note has been added, but it has no content, it is defined, but empty.
In the FOLIO record display, empty and undefined fields may look the same for fields that are always present, such as the Series Statement field in Instance records.
cql.allRecords=1 can be used to identify records with undefined fields.
Conditions |
Sample Query |
Instance display |
Field is defined |
item.notes.note=”” |
Item Note field is present and has a value (which could be “blank” or something else) |
Field is defined and not empty |
item.notes.note=”” NOT item.notes.note==”” |
Item Note field is present and has a value other thank “blank” |
Field is defined and empty |
item.notes.note==”” |
Item Note field is present and has a “blank” value |
Field is not defined |
cql.allRecords=1 NOT item.notes.note=”” |
Item Note field is not present |
Field is defined and not empty or not defined |
cql.allRecords=1 NOT item.notes.note==”” |
Item Note field is either present with a value other thank “blank” or is not present |
Nesting allows clarification of combined Boolean operators
Without nesting, the query:
title all "prarie" and contributors all "Mary" or contributors all "John"
retrieves over 20 thousand records because the Boolean operators are being applied in order.
By nesting the search terms, the query
title all "prarie" and ( contributors all "Mary" or contributors all "John" )
correctly retrieves a single record.
Limiting by Record Type
If you want to search for a given value or string over multiple fields in a given record type, you can use record type limits in your query.
Query Term |
Operator Type |
Sample Query |
Description |
cql.all |
full-text or term |
cql.all all "semantic web" |
Matches instances that have given text in instance, item and holding field values. |
cql.allItems |
full-text or term |
cql.allItems all "book" |
Matches instances that have given text in item field values |
cql.allHoldings |
full-text or term |
cql.allHoldings all "it001" |
Matches instances that have given text in holding field values |
cql.allInstances |
full-text or term |
cql.allInstances any "1234567" |
Matches instances that have given text in instance field values |
Search Fields
Instance Search fields
Field |
Accordion |
Query term |
Operators |
Sample Query |
Administrative note |
Administrative data |
administrativeNotes |
full-text |
administrativeNotes all "librarian note" |
Alternative Title |
Title data |
alternative.Titles. |
full-text |
alternativeTitles. |
Authority ID |
n/a |
authorityId |
term |
authorityId == |
Authority ID (Contributor) |
n/a |
contributors. |
term |
authorityId == "81ae0f60-f2bc-450c-84c8-5a21096daed9" |
Classification (Call #) |
Classification |
classifications. |
term |
classifications. |
Contributor |
Contributor |
contributors |
full-text |
contributors all "John" |
Contributor Type (Name) |
Contributor |
contributors. |
term |
contributors. |
Created |
Administrative data |
metadata.createdDate |
term |
metadata.createdDate > "2021-03-01” |
Electronic Access |
Electronic access |
electronicAccess |
full-text |
electronicAccess any "resource" |
Format Term |
Descriptive data |
instanceFormatIds |
term |
instanceFormatIds == |
HRID |
Administrative data |
hrid |
term |
hrid=="mobiusin*" |
Index Title |
Title data |
indexTitle |
full-text |
indexTitle all "semantic web" |
ISBN |
Identifier data (where Resource Identifier Type = ISBN) |
isbn |
term |
isbn="1234*" |
ISSN |
Identifier data (where Resource Identifier Type = ISSN) |
issn |
term |
issn="1234*" |
Keyword (Resource Title + Alternative Title + Index Title + Series Statement + Resource Identifier + Contributor Name) |
Title data + Identifiers + Contributor |
keyword |
full-text |
keyword all "semantic web" |
Language |
Descriptive data |
languages |
term |
languages == "eng" |
Link Text |
Electronic access |
electronicAccess. |
full-text |
electronicAccess. |
Mode of Issuance |
Administrative data |
modeOfIssuanceId |
term |
modeOfIssuanceId== |
Name |
Contributor |
contributors.name |
term |
contributors.name all "John" |
Name Type |
Contributor |
contributors. |
term |
contributors. |
Nature of Content |
Descriptive data |
natureOfContentTermsIds |
term |
natureOfContentTermIds |
Note |
Instance notes |
notes.note |
full-text |
notes.note all "librarian note" |
OCLC # |
Identifier data (where Resource Identifier Type = OCLC) |
oclc |
term |
oclc="1234*" |
Primary (Contributor) |
Contributor |
contributors.primary |
term |
contributors.primary |
Public Note |
Electronic access |
electronicAccess. |
full-text |
electronicAccess. |
Public Note |
Instance notes |
publicNotes |
full-text |
publicNotes all "public note" |
Publisher |
Descriptive data |
publisher |
full-text |
publisher all "Publisher of Ukraine" |
Resource Identifier |
Identifiers |
identifiers.value |
term |
identifiers.value = "(OCoLC)*" |
Resource Identifier Type |
Identifiers |
identifiers. |
term |
identifiers. |
Resource Type |
n/a |
instanceTypeId |
term |
instanceTypeId == "text" |
Series Statement |
Title data |
series |
full-text |
series all "series" |
Source |
Administrative data |
source |
term |
source=="MARC" |
Staff suppress |
Administrative data |
staffSuppress |
term |
staffSuppress==true |
Status (Instance) Term |
Administrative data |
statusId |
term |
statusId == "Marked for deletion" |
Subject Heading |
Subjects |
subjects all "Chemistry" |
full-text |
subjects all "Chemistry" |
Suppress From Discovery |
Administrative data |
discoverySuppress |
term |
discoverySuppress== |
Tags |
Term |
instanceTags |
term |
instanceTags== |
Title |
Title data |
title |
full-text |
title all "semantic web" |
Uniform Title |
Title data |
uniformTitle |
full-text |
uniformTitle all "semantic web" |
Updated |
Administrative data |
metadata.updatedDate |
term |
metadata.updatedDate > "2020-12-12" |
URI |
Electronic access |
electronicAccess.uri |
term |
electronicAccess.uri= |
UUID |
n/a |
id |
term |
id=="db2fdba3-1764-5354-9efb-ad2be1d6b404" |
Holdings Search Options
Field |
Accordion |
Query Term |
Operators |
Sample Query |
Administrative Note |
Administrative data |
holdings. |
full-text |
holdings. |
Call Number |
Location |
holdingsFullCall |
term |
holdingsFullCall |
Call Number |
Location |
holdingsNormalized |
term |
holdingsNormalized |
Created |
Administrative data |
holdings.metadata. |
term |
metadata.createdDate > "2020-12-12" |
Electronic Access |
Electronic access |
holdings. |
full-text |
holdings. |
Holdings Identifiers |
Administrative data |
holdings |
term |
holdingsIdentifiers == "ho00000000006" |
Holdings Notes |
Holdings Notes |
holdings.notes. |
full-text |
holdings.notes.note all "librarian note" |
Holdings Public Notes |
Holdings Notes, where the Staff Only box is unchecked |
holdingsPublic |
full-text |
holdingsPublicNotes all "public note" |
Holdings Type |
Administrative data |
holdings. |
term |
holdings. |
Holdings Type ID |
??? |
holdingsTypeId |
term |
holdingsTypeId== |
HRID |
Administrative data |
holdings.hrid |
term |
holdings.hrid== |
Link Text |
Electronic access |
holdings. |
full-text |
holdings. |
Permanent Location |
Location |
holdings. |
term |
holdings. permanentLocationId |
Public Note |
Electronic access |
holdings. |
full-text |
holdings. |
Source |
Administrative data |
holdings. |
term |
holdings.sourceId== |
Statistical Code ID |
n/a |
holdings. |
term |
holdings. |
Suppress from Discovery |
Administrative data |
holdings. discoverySuppress |
term |
holdings. holdings. discoverySuppress== false |
Tags |
n/a |
holdingsTags |
term |
holdingsTags== |
Updated |
Administrative data |
holdings.metadata. |
term |
metadata.updatedDate > "2020-12-12" |
URI |
Electronic access |
holdings. |
term |
holdings.electronic |
UUID |
n/a |
holdings.id |
term |
holdings.id== "db2fdba3-1764-5354-9efb-ad2be1d6b404" |
======Item Search Options======
Field |
Accordion |
Query Term |
Operators |
Sample Query |
Administrative Note |
Administrative data |
item. |
full-text |
item.administrative |
Barcode |
Administrative data |
item.barcode |
term |
item.barcode== |
Call Number, Full |
Item data |
itemFullCall |
term |
itemFullCallNumbers= |
Call Number, Normalized |
Item data |
itemNormalized |
term |
itemNormalizedCall |
Call Number Type |
Item data |
callNumberType |
term |
callNumberType = "lc" |
Circulation Note |
Loan and availability |
item.circulationNotes.note |
full-text |
item.circulationNotes.note all "circulation note" |
Effective Location ID |
n/a |
item. |
term |
item.effective |
Created |
Administrative data |
item.metadata. |
term |
item.metadata. |
Electronic Access |
Electronic access |
item.electronic |
full-text |
item.electronicAccess any "resource" |
HRID |
Administrative data |
item.hrid |
term |
item.hrid=="atsuit*" |
Link Text |
Electronic access |
item. |
full-text |
item.electronicAccess.linkText="Folio website" |
Identifiers |
Administrative data |
itemIdentifiers |
term |
itemIdentifiers all "i*:bridges" |
Material Type |
Item data |
item.materialType |
term |
item.materialTypeId= |
Note |
Item notes + Loan and availability |
item.notes.note |
full-text |
item.notes.note all "librarian note" |
Public Note |
Electronic access |
item.electronic |
full-text |
item.electronicAccess.publicNote="a rare book" |
Public Note |
Item notes + Loan and availability |
itemPublicNotes |
full-text |
itemPublicNotes all "public note" |
Shelving Order |
Item data |
item.effective |
term |
item.effectiveShelving |
Status |
Loan and availability |
item.status.name |
term |
item.status.name== |
Suppress from Discovery |
Administrative data |
item.discovery |
term |
item.discovery |
Tags |
n/a |
itemTags |
term |
itemTags="important" |
Updated |
Administrative data |
item.metadata. |
term |
item.metadata. |
URI |
Electronic access |
item.electronic |
term |
item.electronic |
UUID |
n/a |
item.id |
term |
item.id== |