Table of Contents

Bibliographic queries in Evergreen

Evergreen, in trunk as of March 2010 and for all versions after the 1.6 series, uses an advanced, configurable query parser for bibliographic searches. This new parser is much more flexible and featureful than the old one, which hard coded the syntax for parsing queries.

How about … some fun with examples!

Examples

Grammar

First, we'll start with a pseudo-grammar for the new query parser with some inline notes:

regexp                := valid PCRE
word                  := valid UTF-8 non-whitespace characters
whitespace            := string matching PCRE /\s+/s
boolean_word          := 'yes' | 'no' | 'true' | 'false' | '1' | '0'
modifier_marker       := '#'   ### configurable, default
phrase_boundary       := '"'
phrase_left_anchor    := '^'
phrase_right_anchor   := '$'
1_word_phrase_marker  := '+'
negator               := '-'
search_seperator      := ':' | '='
class_field_seperator := '|'
boolean_and           := '&&'  ### configurable, EG default
boolean_or            := '||'  ### configurable, EG default
subquery_start        := '('   ### configurable, default
subquery_end          := ')'   ### configurable, default

word_list             := word { ',' word }
negated_word          := negator word
required_word         := 1_word_phrase_marker word  ### one-word phrase shortcut
phrase                := phrase_boundary { phrase_left_anchor } word { whitespace word } { phrase_right_anchor } phrase_boundary
term                  := word | negated_word | required_word | phrase { whitespace term }

boolean_operator      := boolean_and | boolean_or

registerd_class       := 'keyword' | 'title' | 'author' | 'subject' | 'series'  ### configurable, default for EG
class_alias           := regexp  ### 'kw', 'ti', 'au', 'su', 'se' and many more, configurable, loaded from IDL class cmsa where field is null
search_class          := registered_class | class_alias
registered_field      := word    ### configurable, loaded from IDL class cmf where search_field is true
field_alias           := regexp  ### configurable, loaded from IDL class cmsa where field is not null
registered_facet      := word    ### configurable, loaded from IDL class cmf where facet_field is true

classed_search        := search_class search_seperator term
search_field_list     := registered_field { class_field_seperator search_field_list }
fielded_search        := search_class class_field_seperator { search_field_list } search_seperator term
field_alias_search    := field_alias search_seperator term
facet_list            := registered_facet { class_field_seperator facet_list }
facet_value_list      := term { ' # ' term }
facet_search          := search_class [ class_field_seperator { facet_list } ] '[' facet_value_list ']'
search                := term | classed_search | fielded_search | field_alias_search | facet_search

registered_modifier   := 'available' | 'staff' | 'descending'  ### and many more, defined in QueryParser implementation driver class_alias
search_modifier       := modifier_marker registered_modifier | registered_modifier '(' boolean_word ')'
registered_filter     := 'site' | 'sort' | 'item_type'  ### and many more, defined in QueryParser implementation driver class_alias
search_filter         := registered_filter '(' word_list ')' | registered_filter ':' word_list

boolean_term          := term boolean_op term

subquery              := subquery_start query subquery_end
query                 := term | boolean_term | search | search_modifier | search_filter | subquery { [boolean_op] query }

Evergreen Configuration of the Query Parser

Filters
Modifiers
Registered classes (from the stock config.metabib_class)
Registered search fields (from the stock config.metabib_field)
class name
authorconference
authorcorporate
authorother
authorpersonal
keywordkeyword
seriesseriestitle
subjectcomplete
subjectgeographic
subjectname
subjecttemporal
subjecttopic
titleabbreviated
titlealternative
titleproper
titletranslated
titleuniform
identifierisbn
identifierissn
identifierupc
identifierismn
identifierean
identifierisrc
identifiersici
identifierbibcn
identifieraccession
Registered class and field aliases
alias class field
au author
creator author
name author
kw keyword
se series
su subject
ti title
eg.author author
eg.name author
eg.keyword keyword
eg.series series
eg.subject subject
eg.title title
bib.name author
bib.nameconference author conference
bib.namecorporate author corporate
bib.namepersonal author personal
bib.namepersonalfamily author personal
bib.namepersonalgiven author personal
dc.contributor author
dc.creator author
bib.edition keyword
bib.genre keyword
bib.subjecttitle keyword
dc.identifier keyword
dc.publisher keyword
srw.serverchoice keyword
bib.titleseries series seriestitle
bib.subjectname subject name
bib.subjectoccupation subject complete
bib.subjectplace subject geographic
dc.subject subject
bib.title title abbreviated
bib.titleabbreviated title abbreviated
bib.titlealternative title alternative
bib.titletranslated title translated
bib.titleuniform title uniform
dc.title title
id identifier
dc.identifier identifier
eg.isbn identifier isbn
eg.issn identifier issn
eg.upc identifier upc
eg.callnumber identifier bibcn
Registered facet fields (from the stock config.metabib_field)
class name
authorconference
authorcorporate
authorother
authorpersonal
seriesseriestitle
subjectgeographic
subjectname
subjecttemporal
subjecttopic