FOLIO WIKI
Last edited one month ago
by Vivian

5.1.4 CQL Query Searching in FOLIO Inventory


Constructing a Query Search, using CQL

  1. In FOLIO, enter the Inventory app
  2. Click on the record type you wish to search: Instance, Holdings, or Item
  3. Click on the search type drop-down and select “Query search”
  4. Type your query in the format:

search field operator “value”

    1. You can enter multiple queries through the use of Boolean operators:

search field operator “value” and search field operator “value”

  1. 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)

Wild cards may be used either at the beginning or the ends of strings (“*LEISURE” or “LEISURE*”)


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

Wild cards may be used either at the beginning or the ends of strings (“*982” or “mobiusin*”)


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.
alternativeTitle

full-text

alternativeTitles.
alternativeTitle all “semantic web”

Authority ID

n/a

authorityId

term

authorityId ==
"81ae0f60-f2bc-450c-84c8-5a21096daed9"

Authority ID (Contributor)

n/a

contributors.
authorityId

term

authorityId == "81ae0f60-f2bc-450c-84c8-5a21096daed9"

Classification (Call #)

Classification

classifications.
classificationNumber

term

classifications.
classificationNumber
==“cl1”

Contributor

Contributor

contributors

full-text

contributors all "John"

Contributor Type (Name)

Contributor

contributors.
contributorTypeId

term

contributors.
contributorTypeId == "Author"

Created

Administrative data

metadata.createdDate

term

metadata.createdDate > "2021-03-01”

Electronic Access
(URI + Link Text + Materials Specified + Public Note)

Electronic access

electronicAccess

full-text

electronicAccess any "resource"

Format Term

Descriptive data

instanceFormatIds

term

instanceFormatIds ==
"unmediated -- volume"

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.
linkText

full-text

electronicAccess.
linkText = ”Folio website”

Mode of Issuance

Administrative data

modeOfIssuanceId

term

modeOfIssuanceId==
"single unit"

Name

Contributor

contributors.name

term

contributors.name all "John"

Name Type

Contributor

contributors.
contributorNameTypeId

term

contributors.
contributorNameTypeId all “Personal name”

Nature of Content

Descriptive data

natureOfContentTermsIds

term

natureOfContentTermIds
=="journal"

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
==true

contributors.primary
==false

Public Note

Electronic access

electronicAccess.
publicNote

full-text

electronicAccess.
publicNote=”a rare book”

Public Note
(where “Staff only” is not selected)

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.
identifierTypeId

term

identifiers.
identifierTypeId
==”OCLC”

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

staffSuppress==false

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==
true

discoverySuppress==
false

Tags

Term

instanceTags

term

instanceTags==
"important"

Title
(Resource Title + Alternative Title + Index Title + Series Statement)

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=
http://folio.org*”

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.
administrativeNotes

full-text

holdings.
administrativeNotes all "librarian note"

Call Number
(Call Number Prefix + Call Number + Call Number Suffix)

Location

holdingsFullCall
Numbers

term

holdingsFullCall
Numbers="cn*434"

Call Number
(normalized)

Location

holdingsNormalized
CallNumbers

term

holdingsNormalized
CallNumbers="cn434"

Created

Administrative data

holdings.metadata.
createdDate

term

metadata.createdDate > "2020-12-12"



Electronic Access
(URI + Link Text + Materials Specified + Public Note)

Electronic access

holdings.
electronicAccess

full-text

holdings.
electronicAccess any "resource"

Holdings Identifiers
(UUID + HRID + Former Identifier)

Administrative data

holdings
Identifiers

term

holdingsIdentifiers == "ho00000000006"

Holdings Notes

Holdings Notes

holdings.notes.
note

full-text

holdings.notes.note all "librarian note"

Holdings Public Notes

Holdings Notes, where the Staff Only box is unchecked

holdingsPublic
Notes

full-text

holdingsPublicNotes all "public note"

Holdings Type

Administrative data

holdings.
holdingsTypeId

term

holdings.
holdingsTypeId==
"Physical"

Holdings Type ID

???

holdingsTypeId

term

holdingsTypeId==
"3*"

HRID

Administrative data

holdings.hrid

term

holdings.hrid==
”atsuho*"

Link Text

Electronic access

holdings.
electronicAccess.
linkText

full-text

holdings.
electronicAccess.
linkText="Folio website"

Permanent Location

Location

holdings.
permanentLocationId

term

holdings.

permanentLocationId
=="CCIS General Stacks"

Public Note

Electronic access

holdings.
electronicAccess.
publicNote

full-text

holdings.
electronicAccess.
publicNote="a rare book"

Source

Administrative data

holdings.
sourceId

term

holdings.sourceId==
"FOLIO"

Statistical Code ID
(NOT the code type and NOT the code)

n/a

holdings.
statisticalCodeIds

term

holdings.
statisticalCodeIds
=="123765"

Suppress from Discovery

Administrative data

holdings.

discoverySuppress

term

holdings.
discoverySuppress==
true

holdings.

discoverySuppress==

false

Tags

n/a

holdingsTags

term

holdingsTags==
"important"

Updated

Administrative data

holdings.metadata.
updatedDate

term

metadata.updatedDate > "2020-12-12"

URI

Electronic access

holdings.
electronicAccess.
uri

term

holdings.electronic
Access.uri=
"http://folio.org*"

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.
administrative
Notes

full-text

item.administrative
Notes all "librarian note"

Barcode

Administrative data

item.barcode

term

item.barcode==
" 39835000386924"

Call Number, Full
(Call Number Prefix + Call Number + Call Number Suffix)

Item data

itemFullCall
Numbers

term

itemFullCallNumbers=
"cn*434"

Call Number, Normalized

Item data

itemNormalized
CallNumbers

term

itemNormalizedCall
Numbers="cn434"

Call Number Type
(Supported values: “lc”, “dewey”, “nlm”, “sudoc”, “local”, “other”)

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.
effectiveLocation
Id

term

item.effective
LocationId=="be64699e-10fe-48e1-8ca3-4c5785cdbf22"

Created

Administrative data

item.metadata.
createdDate

term

item.metadata.
createdDate >
"2020-12-12"

Electronic Access
(URI + Link Text + Materials Specified + Public Note)

Electronic access

item.electronic
Access

full-text

item.electronicAccess any "resource"

HRID

Administrative data

item.hrid

term

item.hrid=="atsuit*"

Link Text

Electronic access

item.
electronicAccess.
linkText

full-text

item.electronicAccess.linkText="Folio website"

Identifiers
(UUID + HRID + Former Identifier + Accession Number + Item Identifier)

Administrative data

itemIdentifiers

term

itemIdentifiers all "i*:bridges"

Material Type

Item data

item.materialType
Id

term

item.materialTypeId=
"430d7452-9f83-4fe6-9cf0-b6abf0cdfac6"

Note
(Item Note + Check In/Check Out Note)

Item notes + Loan and availability

item.notes.note

full-text

item.notes.note all "librarian note"

Public Note

Electronic access

item.electronic
Access.publicNote

full-text

item.electronicAccess.publicNote="a rare book"



Public Note
(Item Note (Staff Only unchecked) + Check In/Check Out Note)

Item notes + Loan and availability

itemPublicNotes

full-text

itemPublicNotes all "public note"

Shelving Order

Item data

item.effective
ShelvingOrder

term

item.effectiveShelving
Order="A 12"

Status

Loan and availability

item.status.name

term

item.status.name==
"Withdrawn"

Suppress from Discovery

Administrative data

item.discovery
Suppress

term

item.discovery
Suppress=true

item.discovery
Suppress=false

Tags

n/a

itemTags

term

itemTags="important"

Updated

Administrative data

item.metadata.
updatedDate

term

item.metadata.
updatedDate >
"2020-12-12"

URI

Electronic access

item.electronic
Access.uri

term

item.electronic
Access.uri=
"http://folio.org*"

UUID

n/a

item.id

term

item.id==
"db2fdba3-1764-5354-9efb-ad2be1d6b404"