Was this article helpful?

Writing Your Own Queries

You can create custom search queries by typing your query directly into the advanced Boolean query box on the Advanced Search page. For example, you could enter…

Anywhere:(canadian immigration)  -Title:(census)  language:(eng)  format:(BK)

… to find books in English on Canadian immigration that do not have the word census in the title.

The information below will help you construct your queries.

Fields

Advanced search makes it possible to indicate the kind of information you are looking for by specifying a field in the catalogue. Below is a list of commonly used fields. Each field also has a two-letter code; either can be used to specify a field.

 

Field Name Field Code Example
Agerating ag ag:14A
Anywhere an leprechaun or an:leprechaun
Artist ar ar:beatles
Audience ad ad:juvenile
Author au au:enright
Available av av:Main
Award aw aw:giller
Branch br br:Main
Call Number ca ca:”J 637.4 GRE”
Contents cn cn:(Hey Jude)
ContentType cc cc:Fiction
Contributor co co:shepard
Edition ed ed:(special education edition)
FictionType* ft ft:nonfiction
Format fo fo:dvd
GeneralNote gn gn:(includes index)
Genre ge ge:biography
GenreHeading gh gh:memoire
GenreTag gt gt:synthpop
Identifier id id:972.81016Sch
Language la la:fre
Lexile lx lx:[200 TO 300]
LocalHeading lh lh:local author
Localid li li:436899
Mood mo mo:dark
New nw nw:[0 TO 30]
Notes no no:(live recording)
Period pe pe:[794 TO 1185]
Publisher pu pu:groundwood
Pubyear py py:[1918 TO 1939]
Region re re:babylon
Series se se:(bartimaeus trilogy)
Starrating sr sr:5  or  sr:[4 TO 5]
Subject su su:samarkand
SubjectHeading sh sh:revolutions
Summary sm sm:shylock
Tag tg tg:(slow food)
Theme th th:energy
Title ti ti:macbeth
Topic tp tp:volcanoes
TopicTheme tt tt:geothermal

 

* Deprecated.

To create a search, specify a field, followed by a colon “:”, followed by a word or value. For example:

series:eye

will find any work that is part of a series with the word “eye” in its name.

If you don’t specify a field, the search engine will look for the word anywhere and search all fields. The following query will look for “eye” in the series field, and look for the word “witness” anywhere:

series:eye witness

Use parentheses to look for more than one word within a specified field:

series:(eye witness)

Boolean Operators

Search terms may be combined using the Boolean operators AND, OR and NOT.

Boolean operators must be ALL CAPS. However, field specifiers and words or values are not case sensitive.

AND / OR

AND is the default operator when more than one field is specified. In an AND operation, only works that meet all field constraints will be returned.

Use OR to find all works that match one (but not necessarily all) of several field constraints.

Use parentheses to group clauses to a single field, or to group OR clauses together. For example, to search for a work with a title containing “Poppins”, and either dvd or video-cassette formats, use the query:

title:poppins format:(dvd OR vc)

NOT

The NOT operator excludes works that contain the term after NOT. The “-” symbol can be used in place of the word NOT, but must not be followed by a space. To search for works described by potter but not harry use either of these queries:

Potter NOT Harry
Potter -Harry

The NOT operator cannot be used with just one term. For example, the following search will return no results:

NOT Harry

Wildcard Searches

Wildcard searches use a special character, the * symbol, that may be replaced by zero or more characters to create a match. For example, to search for judicial, judiciary or judicious, you can use the search:

judici*

You can also use the wildcard character in the middle of a term.

col*r

You cannot use a * symbol as the first character of a search.

Another use for wildcards is to find a group of titles using call numbers. For example, ca:330* or callnumber:330* (if the call number does not contain a space), or ca:”J 636.7*” (quotes required if the call number contains a space). You can use either an asterisk ( * ) to represent multiple characters or question mark ( ? ) as a single-character wildcard. You can also search for a range of items. For example: ca:["PRE" TO "PRO"].

Range Queries

Range queries enable you to match documents whose field values are between the lower and upper bound specified by the range query.

pubyear:[1960 TO 1999]

This will find works that were published between 1960 and 1999, inclusive.

sr:[4 TO 5]

This will find titles with average star-rating of between 4 and 5.

Range queries can be inclusive or exclusive of the upper and lower bounds. Inclusive range queries are denoted by square brackets. Exclusive range queries are denoted by curly brackets.

Escaping Characters

Advanced Search supports escaping special characters that are part of the query syntax. The current list special characters are

+ – && || ! ( ) { } [ ] ^ ” ~ * ? : \

To escape these characters use the \ before the character. For example to search for (1+1):2 use the query:

\(1\+1\)\:2

Note: The search syntax in the Advanced Search is largely based on Lucene.

Was this article helpful?
Pages that link here
Page statistics
13574 view(s), 12 edit(s) and 12995 character(s)

Tags

This page has no custom tags set.

Comments

You must to post a comment.

Attach file

Attachments