This guide explains how to perform search queries on InvenioILS using easy to understand examples.

### Simple search (one or multiple terms)

Example: `dark matter`

Results will match records with the terms `dark` or `matter` in any field.

You can require presence of both terms using either the `+` or `AND` operator:

Examples: `+dark +matter` or `dark AND matter`

You can require absence of one or more terms using either the `-` or `NOT` operator:

Examples: `-dark +matter` or `NOT dark AND matter`

### Phrase search

Example: `"dark matter"`

Results will match records with the phrase `dark matter` in any field.

### Field search

Example: `title:matter`

Results will match records with the term `matter` in the field `title`. If you want to search for multiple terms in the title you must group the terms using parenthesis:

Example: `title:(dark matter)`

See the field reference below for the full list of fields you can search.

### Combined simple, phrase or field search

Example: `+title:"dark matter" -title:experiment` or `title:(-dark +matter)`

You can combine simple, phrase and field search to construct advanced search queries.

### Range search

Example: `publication_year:[2020 TO 2021]` (note, you must capitalize `TO`).

Results will match any record with a publication date between 2020-01-01 and 2021-12-31 (both dates inclusive).

Examples of other ranges:

- `publication_year:{* TO 2020}` - All days until 2020.
- `publication_year:[2020 TO *]` - All days from 2020.

### Examples of searches on literature

#### Identifiers

Example:

- `"9814749133"` or `"9789814749138"` - ISBN 10 or 13
- `"10.1016/j.physletb.208020"` - DOI
- `"1745-2481"` - ISSN
- `"NF-EN-81-80”` - Standard number

Results will match exactly the provided identifier.

#### Author and affiliation

Example:

- `authors.full_name:(Albert Einstein)` - literature from a specific author
- `authors.affiliations.name:CERN` - literature whose author is affiliated to CERN
- `full_name.keyword: /Otto, .+/` - Look for authors whose last name is Otto

#### Literature source

Example:

- `conference_info.acronym:(CHEP*) AND conference_info.year:2019` - conference papers from a particular year
- `publication_info.journal_title: "Nucl. Instrum. Methods Phys. Res., A"` - publications in a journal
- `publication_year:2020` - publication year to disambiguate versions

### Ranking/Sorting

By default all searches are sorted according to an internal ranking algorithm that scores each match against your query. In both the user interface and REST API, it's possible to sort the results by:

- Recently added
- Most relevant
- Available copies
- Most loaned
- Publication year [oldest / newest]
- Title [A-Z / Z-A]

### Advanced concepts

#### Boosting

You can use the boost operator `^` when one term is more relevant than another. For instance, you can search for all records with the phrase Dark matter in either title or description field, but rank records with the phrase in the title field higher:

Example: `title:"dark matter"^5 description:"dark matter"`

Note: `^` is followed by a positive floating point number specifying the boost value compared to the default 1.

#### Fuzziness

You can search for terms similar to but not exactly like your search term using the fuzzy operator `~`.

Example: `drak~`

Results will match records with terms similar to `drak` which would e.g. also match `dark`.

#### Proximity searches

A phrase search like `"collision theory"` by default expect all terms in exactly the same order, and thus for instance would not match the record entitled "Quantum collision theory", but not the record "Theory of heavy ion collision physics in hadron therapy". A proximity search allows that the terms are not in the exact order and may include other terms inbetween. The degree of flexiblity is specified by an integer afterwards:

Example: `"collision theory"~10`

#### Wildcards

You can use wildcards in search terms to replace a single character (using `?` operator) or zero or more characters (using `*` operator).

Example: `title:(crab cavit*)`

The result will match the literature with title referring to cavities also in languages other than english.

Wildcard searches can be slow and should normally be avoided if possible.

## Fields reference

The table below lists the data type of each field. Below is a quick description of what each data type means and what is possible.

- string: Field does not require exact match (example field: `title`).
- string (exact): Field requires exact match (example field: `title`).
- CV: Controlled vocabularies but take only a specific list of values.
- integer: A number (range queries possible).
- datetime: An ISO8601 date or datetime, e.g. `2020-12-31` (range queries possible).
- boolean: `true` or `false`.

In case of multiple subfields, (`\*`) applies to all of them

### Common fields

Field name | Type | Notes
--- | --- | ---
`abstract` | string | -
`alternative_abstracts` | string | -
`alternative_identifiers.\*` | string | Identifiers: material, scheme, value
`alternative_titles.\*` | string | -
`alternative_titles.language` | CV | -
`alternative_titles.source` | string (exact) | -
`alternative_titles.type` | CV | -
`alternative_titles.value` | string | -
`created_by.\*` | string | -
`created_by.type` | string (exact) | -
`created_by.value` | string (exact) | -
`edition` | string | -
`identifiers.\*` | string | Identifiers: material, scheme, value
`keywords.\*` | string | Keywords: source, value
`languages` | CV | -
`note` | string | -
`pid` | string (exact) | -
`publication_year` | string (exact) | -
`relation_types` | string (exact) | -
`relations.\*` | string | -
`tags` | CV | -
`title` | string | -
`updated_by.\*` | string | -
`updated_by.type` | string (exact) | -
`updated_by.value` | string (exact) | -
`urls.\*` | string | URLs: description, value

### Documents

Field name | Type | Notes
--- | --- | ---
`authors.\*` | string | -
`authors.affiliations.\*` | string | -
`authors.affiliations.identifiers.\*` | string | Identifiers: scheme, value
`authors.affiliations.name` | string (exact) | -
`authors.alternative_names` | string (exact) | -
`authors.full_name` | string | -
`authors.identifiers.\*` | string | Identifiers: material, scheme, value
`authors.roles` | CV | -
`authors.type` | CV | -
`circulation.\*` | string | -
`circulation.active_loans` | integer | -
`circulation.can_circulate_items_count` | integer | -
`circulation.available_items_for_loan_count` | integer | -
`circulation.has_items_on_site` | integer | -
`circulation.next_available_date` | date | -
`circulation.overbooked` | boolean |
`circulation.overdue_loans` | integer | -
`circulation.past_loans_count` | integer | -
`circulation.pending_loans` | integer | -
`curated` | boolean | -
`document_type` | string (exact) | -
`eitems.\*` | string | E-Items
`imprint.\*` | string | -
`imprint.date` | date | -
`imprint.place` | string (exact) | -
`imprint.publisher` | string (exact) | -
`imprint.reprint` | string | -
`items.\*` | string | Items
`licenses.\*` | string | -
`licenses.license.\*` | string | -
`licenses.license.id` | CV | -
`licenses.license.maintainer` | string (exact) | -
`licenses.license.status` | string (exact) | -
`licenses.license.title` | string (exact) | -
`licenses.license.url` | string (exact) | -
`licenses.material` | string (exact) | -
`number_of_pages` | string (exact) | -
`other_authors` | boolean | -
`publication_info.\*` | string | -
`publication_info.artid` | string (exact) | -
`publication_info.journal_issue` | string (exact) | -
`publication_info.journal_title` | string (exact) | -
`publication_info.journal_volume` | string (exact) | -
`publication_info.note` | string (exact) | -
`publication_info.pages` | string (exact) | -
`publication_info.year` | string (exact) | -
`restricted` | boolean | -
`source` | string (exact) | -
`stock.mediums` | CV | -
`subjects.\*` | string | Subjects: scheme, value
`table_of_content` | string | -

### Series

Field name | Type | Notes
--- | --- | ---
`abbreviated_title` | string | -
`access_urls.\*` | string | -
`access_urls.access_restriction` | CV | -
`access_urls.description` | string | -
`access_urls.open_access` | boolean | -
`access_urls.value` | string (exact) | -
`authors` | string | -
`isbn` | string (exact) | -
`issn` | string (exact) | -
`mode_of_issuance` | CV | -
`publisher` | string | -