Skip to main content

Search Operators

Last updated on 02-28-2024


Jump to: Metadata Field OperatorsList of Common Field OperatorsList of Collection CodesSearching MODs Metadata


Search Query Operators

Because queries can be very complex and can use several different operators, there needs to be a way to evaluate expressions unambiguously. This is done through the use of operator precedence, which is a way of specifying which operators and expressions are evaluated first, second, and so on. In the list below, the precedence of the operators is from first to last.

  • not
  • -
  • +
  • field operators
  • adj
  • before/#
  • near/#
  • and
  • or

The sections that follow will show you how to use a variety of characters and operators to narrow your search.


Spaces

A space is used to separate words or operators in a search query. In a simple query where operators are not used, spaces between words are treated as an implied "and" so that the search results will contain documents containing all of the words that have been entered.

Note: In certain cases, the search engine will automatically assume that two terms separated by a single space should be treated as a single phrase to increase the accuracy of results. This primarily occurs with proper names.

For complex queries using operators, the following should be noted:

  • When Boolean operators are used, spaces between words are treated as an implied "and" until another operator is used in the query.
  • When the "-" or "+" operators are used, a space should not be placed between the operator and the word entered. The "-" and "+" operators only apply to the word directly attached to the operator.
  • When field operators are used, a space should not be placed between the operator and the word or phrase being searched. It is recommended that parentheses be used with field operators. For example, title:(legislation environment).
  • When proximity operators are used, the operator only applies to the word, or phrase in quotes, immediately before and after the operator. It is recommended that parentheses be used around the proximity expression when creating complex queries.

Example

To search for only those documents that contain both the words Bill and Clinton, you can enter Bill Clinton into the Search Box and click the Search button. The search engine will look for both words in the document and return those documents where both words can be found anywhere in the document.


Quotation Marks

Quotation marks tell the search engine to return documents if and only if they contain the exact phrase or string of words between quotes.

Examples

  • "congressional hearing" retrieves Documents with the word "congressional" directly followed by the word "hearing".
  • "ways and means" retrieves documents with the words "ways", "and", and "means" in the specified order, right next to each other.
  • ways "and" means retrieves Documents with the words "ways", "and", and "means" anywhere in the document. Note: Since "and" is in quotes, it is treated as a phrase instead of being treated as an operator.

Boolean Operators

A Boolean search is a search that uses the logical (i.e., Boolean) operators (AND, OR, NOT, -) in addition to the keywords.

  • AND: The AND operator tells the search engine to return only documents with all the keywords you entered. This operator narrows the search and returns fewer search results
  • OR: The OR operator tells the search engine to return documents if they contain one or more keywords.
  • NOT: The NOT operator tells the search engine to exclude documents from a search if they contain the keywords.
  • - Operator: The "-" operator is the same as the NOT operator and tells the search engine to exclude documents from a search if they contain the keywords.

Note: Boolean operators are not case sensitive. For example, entering and or AND will return the same results.

Examples

  • congressional and hearing retrieves documents with both the word "congressional" and "hearing" anywhere inside the document.
  • congressional or executive retrieves documents with either the word "congressional" or "executive" or both.
  • congressional not report retrieves documents with the word "congressional" but not the word "report".
  • congressional -report retrieves documents with the word "congressional" but not the word "report" The "-" operator can be used in place of the not operator, but must prefix the word (or expression) without any intervening spaces.
  • congressional and not report retrieves documents with the word "congressional" but not the word "report" The operators "and not" behaves the same as "not".
  • "ways and means" retrieves documents with the words "ways", "and", and "means" in the specified order, right next to each other. Since "and" is part of the phrase in quotes, it is treated as part of the phrase instead of being treated as an operator.
  • ways "and" means retrieves documents with the words "ways", "and", and "means" anywhere in the document. Since "and" is in quotes, it is treated as a phrase instead of being treated as an operator.
  • title:environment and member:mikulski retrieves documents with the word "environment" in the title and "mikulski" in the member field.
  • title:(hearing or meeting) retrieves documents with either "hearing" or "meeting" in the title field.
  • title:chesapeake and title:bay retrieves documents with both the word "chesapeake" and the word "bay" in the metadata title field, but not necessarily in order.
  • congressional and not report retrieves documents with the word "congressional" but not the word "report" The phrase "and not" behaves the same as "not".
  • congressional not (committee report) retrieves documents with the word "congressional" but not if they contain both the words "committee" and "report".
  • congressional not (committee or meeting) retrieves documents with "congressional" but not "committee"; documents with "congressional" but not "meeting".
  • congressional -(committee or meeting) retrieves documents with "congressional" but not "committee"; documents with "congressional" but not "meeting" The "-" operator works with parenthetical expressions as well.

Proximity Operators

Proximity Operators allow you to specify searches where one word is near, next to, or in the vicinity of another word. The three proximity operators defined are:

  • Adj: The adj proximity operator specifies that one word is adjacent to another in a document.
  • before/#: The before/# proximity operator specifies that the first word is within # words and before the second word.
  • near/#: The near/# proximity operator specifies that the first word is within # words of the second word.

Examples

  • congressional adj hearing retrieves documents with the word "congressional" directly followed by the word "hearing".
  • representative near/10 cardin retrieves documents with the word "representative" within 10 words of the word "cardin".
  • representative near cardin retrieves documents with words "cardin", "near", and "representative" anywhere inside the document. The term "near" is only an operator when it has the /# as the suffix otherwise it is treated just like a regular word.
  • representative before/10 cardin retrieves documents with the word "representative" within 10 words and before the word "cardin".
  • representative before cardin retrieves documents with words "cardin", "before", and "representative" anywhere inside the document. The term "before" is only an operator when it has the /# as the suffix otherwise it is treated just like a regular word.
  • (Bill and Clinton) before/100 (Hillary and Clinton) This will return an "unsupported proximity operator" error. The "and" operator (implied or otherwise) can not be nested within a proximity operator.
  • (Bill adj Clinton) before/100 (Hillary adj Clinton) retrieves documents with the name "Bill Clinton" within 100 words of the name "Hillary Clinton" A successful version of the above query. Note that all operators within a proximity expression must themselves be proximity operators.
  • not Bill before/100 Clinton will also return an "unsupported proximity operator" error. The "not" operator is not allowed to be within a proximity expression.

Note: Because a proximity expression is trying to find words (or phrases with quotes) that are located within a specified proximity of each other, using Boolean operators or multiple words without quotes in a proximity expression will result in a search query error. One way to make sure that you do not get search query errors is to always use parentheses around the proximity expression when creating search queries that use proximity operators. Examples of proximity expressions using quotes:

  • environment not ("Bill Clinton" before/100 "Hillary Clinton")
  • environment (Clinton near/10 Bush)

Parentheses

Parentheses are used to group words and expressions so that the result of evaluating the expression between the parentheses can be used as part of a more complex query. The use of parentheses is recommended to isolate expressions in your query from other expressions, especially when creating complex queries using proximity operators and field operators.

Examples

  • (congressional or executive) and hearing retrieves documents with both words "congressional" and "hearing," as well as with both words "executive" and "hearing".
  • title:(hearing or meeting) retrieves documents with either "hearing" or "meeting" in the title field.
  • title:(chesapeake bay) retrieves documents with both the word "chesapeake" and the word "bay" in the metadata title field, but not necessarily in order.
  • congressional not (committee report) retrieves documents with the word "congressional" but not if they contain both the words "committee" and "report".
  • Congressional not (committee or meeting) retrieves documents with "congressional" but not "committee"; documents with "congressional" but not "meeting".
  • congressional -(committee or meeting) retrieves documents with "congressional" but not "committee"; documents with "congressional" but not "meeting". The "-" operator works with parenthetical expressions as well.
  • (Bill and Clinton) before/100 (Hillary and Clinton) will return an "unsupported proximity operator" error. The "and" operator (implied or otherwise) can not be nested within a proximity operator.
  • (Bill adj Clinton) before/100 (Hillary adj Clinton) retrieves documents with the name "Bill Clinton" within 100 words of the name "Hillary Clinton" A successful version of the above query. Note that all operators within a proximity expression must themselves be proximity operators.

Number of Hits

The Number of hits "+" operator can be used to specify that documents with more hits on a particular word be given preference over documents with hits on other words.

Examples

  • +cardin congressional committee retrieves documents with words "cardin", "congressional", and "committee" anywhere inside the document with documents having more hits on "cardin" being given higher relevancy than documents with more hits on "congressional" or "committee".
  • ++cardin congressional +committee retrieves documents with words "cardin", "congressional", and "committee" anywhere inside the document with documents having more hits on "cardin" being given the highest relevancy, followed by documents having more hits on "committee" given the next highest relevancy, and documents having more hits on "congressional" given lower relevancy.

Wild Cards

Wild cards can be used as substitutions for one or more characters in a search term

  • ?: The ? wild card replaces a single character before, within, or after a search term.
  • *: The * wild card replaces one or more characters before, within, or after a search term.

Examples

  • congress* retrieves documents which contain words which start with "congress" (such as "congressional", "congressman", etc.)
  • con*al retrieves documents which start with "con" and end in "al", such as "congressional" and "confessional".
  • capitali?e retrieves documents where certain characters can be any character in the word. In this case, example matches include documents which contain "capitalize" or "capitalise".

Metadata Field Operators

Field operators are operators that represent metadata fields. Using field operators tells the search engine to retrieve documents where the value of the metadata field is equal to the value given in the field operator expression. Searches with field operators are useful when you know the values of descriptive data (metadata) such as titles, sponsors, and dates.

Range is used to specify the set of all values a query should return.

  • A date range is the set of all dates from the first date in the expression to the last date in the expression.
  • A number range is the set of all whole numbers from the first number in the expression to the last number in the expression.

When using field operators, you must observe the following rules:

  • The field must be a valid field name or a Field Error will be reported.
  • The values entered for metadata values must match the format in which they are being stored.
  • There must be no spaces on either side of the ":" for the field to be considered as a field restriction.

Examples

  • title:hearing retrieves documents where the word "hearing" occurs in the title of the document
  • title:environment and member:mikulski retrieves documents with the word "environment" in the title and "mikulski" in the member field
  • title:(hearing or meeting) retrieves documents with either "hearing" or "meeting" in the title field
  • title:chesapeake bay retrieves documents with the word "chesapeake" in the metadata title field and the word "bay" in the document
  • title:"chesapeake bay" retrieves documents with the phrase "chesapeake bay" in the metadata title field
  • title:(chesapeake bay) retrieves documents with both the word "chesapeake" and the word "bay" in the metadata title field, but not necessarily in order
  • title:chesapeake and title:bay retrieves documents with both the word "chesapeake" and the word "bay" in the metadata title field, but not necessarily in order
  • title:chesapeake title:bay retrieves documents with both the word "chesapeake" and the word "bay" in the metadata title field, but not necessarily in order
  • congress:range(100,105) retrieves documents for all congresses with numbers 100 up to and including 105
  • publishdate:range(2006-01-01,2006-07-01) retrieves documents with an issue date from January 1, 2006 through July 1, 2006
  • publishdate:range(2006,2006) retrieves documents with an issue date from Jan 1, 2006 through December 31, 2006
  • congress:range(,105) retrieves documents with all congresses up to and including the 105th
  • publishdate:range(2006-01-01,) retrieves documents with all issue dates after and including 2006-01-01

The table below lists commonly used field operators that apply to all or most of the collections.

Lists of collection-specific metadata field operators are available under the What's Available section.

Common Field Operators for Most Collections

Metadata Field Display NameField OperatorExample
Collectioncollection:collection:chrg
Government Authorgovernmentauthor:governmentauthor:house
Publication Datepublishdate:publishdate:2006-09-30
SuDoc Class Numbersudocclass:sudocclass:"y 4.c 73/8:"
Ingestion Dateingestdate:ingestdate:2008-12-29
Publisherpublisher:publisher:"u.s. government printing office"
Branchbranch:branch:legislative
Categorycategory:branch:(regulatory information)
Seriesseries:series:"BOEM Environmental Studies"
Titletitle:title:(railroad safety)
Congress Numbercongress:congress:109
Congress Membermember:member:mcconnell
Presidentpresident:president:clinton
Citationcitation:citation:"Public Law 105-264"
Reference Citationrefcitation:refcitation:"Public Law 105-264"
Electronic Location (URL)url:url:pkg/BILLS-111hr1071ih/pdf/BILLS-111hr1071ih.pdf
Package IDpackageid:packageid:FR-2009-03-31
Granule IDgranuleid:granuleid:E9-7073

Collection Codes

Collection Code Collection Name

GPO

Additional Government Publications

GOVPUB

Bulk Government Publications

CZIC

Coastal Zone Information Center

CFR

Code of Federal Regulations

COMPS

Statute Compilations

CPD

Compilation of Presidential Documents

BILLS

Congressional Bills

CCAL

Congressional Calendar

CPRT

Congressional Committee Prints

CDIR

Congressional Directory

CDOC

Congressional Documents

CHRG

Congressional Hearings

CREC

Congressional Record

CRECB

Congressional Record (Bound Edition)

CRI

Congressional Record Index

CRPT

Congressional Reports

SERIALSET

Congressional Serial Set

CMR

Congressionally Mandated Reports

ECONI

Economic Indicators

ERP

Economic Reports of the Presidents

ERIC

Educations Reports from ERIC

FR

Federal Register

GAOREPORTS

GAO Reports and Comptroller General Decisions

HOB

History of Bills

HJOURNAL

House Journal

HMAN

House Manual

LSA

List of CFR Sections Affected

PAI

Privacy Act Issuances

PLAW

Public and Private Laws

PPP

Public Papers of the Presidents of the United States

SMAN

Senate Manual

USCODE

United States Code

USCOURTS

United States Courts Opinions

GOVMAN

United States Government Manual

STATUTES

United States Statutes at Large

BUDGET

President's Budget

DOI

Department of Interior Inspector General Reports

ERP

Economic Report of the President (1995)

HJOURNAL

Journal of the House of Representatives


Searching MODS Metadata

MODS is a metadata standard that includes information about a digital object. It stands for Metadata Object Description Schema and the standard is maintained by the Library of Congress.

You can perform a search over any field in the MODS metadata.

Examples:

  • A search for mods:presidentialDoc:@type:execord will result in a list of documents that have the attribute type:execord in the presidentialDoc field in the MODS and are therefore Executive Orders.
  • A search for mods:dateIngested:(2012-04-13) will result in a list of documents that have the value 2012-04-13 in the dateIngested field in the MODS and were therefore ingested into the system on April 13, 2012.
  • A search for mods:identifier:(@type:"former package identifier":"f:h100ih.txt") will result in a list of documents that have the value f:h100ih.txt for the attribute type:"former package identifier" in the identifier field in the MODS.