Skip to Main Content

Catalog Help and Documentation

Query Search

Query Search Overview

Query search is the most powerful search option available in the Library of Congress Catalog. It is appropriate for advanced users. Like Advanced Search, Query Search allows users to construct complex searches; however, Query Search runs against a more comprehensive set of fields including Publishers, Note contents, Electronic access information, and item statuses and supports nested queries.

To initiate a query search from the Simple Search interface, select Query and use the guidance below to construct a query.

Please note: Queries are case sensitive.

Contextual Query Language (CQL)

Query Search uses Contextual Query Language (CQL). CQL queries are composed one or more search clauses connected by Boolean operators. A search clause is composed of an Index Attribute, Operator, and a Search Term. See Examples below for syntax.

Index Attribute

The index Attribute indicates the index that the query is running against. For a complete list of Index Attributes supported by this catalog see Index Attributes below.

Operator

all matches records where each term appear in the field
any matches records where any terms appear in the field
== exact match

Search Term

Search terms should be enclosed in double quotes. They can contain a single word or phrase and may include special characters. They can also be empty ("').

Supported Boolean Operators

Users can combine search clauses with AND, OR, NOT.

Query search supports nested logic so users can control the order in which these Booleans are applied using parentheses.

Examples

Examples

Please click and explore these sample Queries to see the search results in the catalog.

Example 1: identifiers.value = "034061163626"

Example 2: identifiers.value = "TROY1636" 

Example 3: notes.note all “When I went to Leland” AND contributors all “Lomax”

  • This query attempts to look across notes for a particular song title ("When I went to Leland") and the contributor "Lomax." This query finds 1 matching record. The notes.note field searches across over 40 different kinds of notes fields.
  • Notes and Contributors are both indexed in the Basic Keyword, but there is no other way to directly search Notes fields. 
  • To construct this Query in the catalog, a user could also use an Advanced search for an "exact phrase" search for the song title with the contributor (keyword containsAll ""When I went to Leland"" AND contributor containsAll "Lomax"). Query, however, offers a more targeted search of only notes fields.

Example 4: notes.note all "hugo nebula award" AND notes.note all "space"

  • This is another example of a targeted search of notes and phrases.

Example 5: notes.note all “italian” AND subjects all “Fiction films” and item.status.name=="Available"  

  • This is particular example will look for other language in notes fields not encompassed by the language facet.

Example 6: electronicAccess.publicNote= “Available onsite via Stacks”

  • Query offers the only way to search records for electronic access links. This particular example may be helpful for researchers trying to understand what collections are only available on site via our on site digital Stacks before planning any trips. While the collections themselves may still only be available on site, the Query search can help patrons independently research digital Stacks holdings from their homes. For more about Stacks: https://ask.loc.gov/faq/399100.

Example 7: electronicAccess.publicNote="digital viewing copy"

  • This is another example where the search results have these words as part of their link text.
  • As you scroll through the results, you'll note that this is not an exact phrase search and a result may match based on the note text: View digital PDF copy online in Arizona Memory Project.

Example 8: electronicAccess.uri="*pmscd.03179"  

  • Unlike the previous electronic access Queries, this looks at the actual uri which may be distinct and is looking to match against a distinct identifier ("pmscd.03179"). 
  • To avoid having to match the entire string, use the *" to match any of the text ahead and simply supply the unique digital object identifier. 
  • A separate Query would be needed if this is in the holdings uri: holdings.electronicAccess.uri="*pmscd.03179"

Example 9: holdings.electronicAccess.linkText=="stacks" AND item.status.name=="Available" AND notes.note all "map"

  • Query is the only way to search metadata in the holdings records and item records. Holdings metadata may include locations, identifiers, and holdings specific electronic access information. Item metadata may include the item status, notes, and dates. 

Example 10: uniformTitle all "平家物語."

  • Query is the only way to search the uniform title specifically for precision when you know there might be variations or difficulty narrowing down your search. 

Example 11: uniformTitle all "flute music, flutes"

  • Another example of a uniform title specific search

Example 12: indexTitle all "Daily Oklahoman"

  • Index title is always included in all the catalog's basic keyword and title searches, but this query offers a much more targeted search.

Example 13: classifications.classificationNumber=="dv*"

  • Classification can be browed directly via the toolbar browse options, but there is no other way to construct a complex search against classification and other search inputs together.

 

 

 

 

 

Attributes

Index attributes for CQL queries
Index Attribute for Query

Keyword

(includes Titles, Contributors, and identifiers)

keyword

Contributors

(includes all contributors regardless of contributor type of name type)

contributors

Title

(includes Resource title, Alternative title, Index title, and Series Statement)

title

Identifiers

(includes all identifiers, regardless of type)

identifiers.value

Classification number classifications.classificationNumber

ISBN 

(includes valid and invalid ISBNs)

isbn

ISSN

(includes valid and invalid ISSNs as well as Linking ISSN)

issn

LCCN 

(includes active and canceled LCCNs)

lccn

Notes

(includes all note types and administrative notes)

note.note
Place of publication publication.place
Subject subjects

 

Learn More

For current documentation of CQL implementation in the FOLIO library service platform, which underpins this catalog, see CQL Support on FOLIO GitHub.

For additional information on the CQL standard please see Library of Congress CQL Standard.