Internally, Europeana uses Apache Solr platform to index its data and therefore Apache Lucene Query Syntax is inheritly supported by the Search API. Advanced users are encouraged to use Lucene and Apache SOLR guides to get the most out of the Europeana repository. For others, we supply a basic guide for querying Europeana.
Basic Search
To look for records that contain a search term in one of the data fields, provide the term as a query parameter:
Syntax: "Mona Lisa"
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query="Mona+Lisa"
Test on API Console
Note that like in many other search applications omitting the quotes will result in searching for records that contain the term Mona or the term Lisa but not necessarily both of them.
If you want to limit your search to a specific data field you should provide the name of the field using the following syntax. For example, to look for objects whose creator is Leonardo da Vinci:
Syntax: who:"Leonardo da Vinci"
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query=who:"Leonardo+da+Vinci"
Test on API Console
Boolean Search
To combine several fields in one search one can use boolean operators AND, OR, and NOT (note the case-sensitivity). Use parentheses to group logical conditions. Note that two consecutive terms without any boolean operator in between default to the AND operator.
Syntax: mona AND lisa
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query=mona+AND+lisa
Test on API Console
Boolean operators can also be combined with the search by fields. The following example searches for objects whose location is in Paris or in London:
Syntax: where:(Paris OR London)
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query=where:(Paris+OR+London)
Test on API Console
The boolean NOT operator cannot be used alone but only in conjunction with another boolean operator. For example, looking for objects which contain the term Lisa but do not contain the term Mona is done by the following:
Syntax: lisa NOT mona
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query=lisa+NOT+mona
Test on API Console
Range Search
To execute range queries, the range operator should be used. This example will search for objects whose field values fall between a and z:
Syntax: [a TO Z]
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query=%5Ba+TO+z%5D
Test on API Console
As well as for textual fields it can also be used for numeric values, date ranges, or geographical areas, as shown below.
Geographical Bounding Box Search
To search for objects by their geographic location you should specify the bounding box of the area. You need to use the range operator and the pl_wgs84_pos_lat (latitude position) and pl_wgs84_pos_long (longitude position) field. The following example will bring all the objects found between the latitude of 45° and 47° and between the longitude of 7° and 8°:
Syntax: pl_wgs84_pos_lat:[45 TO 47] AND pl_wgs84_pos_long:[7 TO 8]
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query=pl_wgs84_pos_lat:%5B45+TO+47%5D+AND+pl_wgs84_pos_long:%5B7+TO+8%5D
Test on API Console
Timestamp Search
One can also search objects by date. Currently, full-fledge date search is supported only for the fields storing the creation (timestamp_created) and update (timestamp_update) dates of the objects which are available in two formats: the UNIX epoch timestamp and the ISO 8601 formatted date. To search for objects created or updated on a given date, use the following query:
Syntax: timestamp_created:"2013-03-16T20:26:27.168Z"
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query=timestamp_created:"2013-03-16T20:26:27.168Z"
Test on API Console
Syntax: timestamp_update:"2013-03-16T20:26:27.168Z"
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query=timestamp_update:"2013-03-16T20:26:27.168Z"
Test on API Console
Searching for date range (as [date1 TO date2]):
Syntax: timestamp_created:[2013-11-01T00:00:0.000Z TO 2013-12-01T00:00:00.000Z]
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query=timestamp_created:%5B2013-11-01T00:00:0.000Z+TO+2013-12-01T00:00:00.000Z%5D
Test on API Console
Syntax: timestamp_update:[2013-11-01T00:00:0.000Z TO 2013-12-01T00:00:00.000Z]
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query=timestamp_update:%5B2013-11-01T00:00:0.000Z+TO+2013-12-01T00:00:00.000Z%5D
Test on API Console
Date mathematics
With date mathematics you can formulate questions, such as "in the last two months" of "in the previous week". The basic operations and their symbols are addition (+), substraction (-) and rounding (/). Some examples:
- now = NOW
- tomorrow: NOW+1DAY
- one week before now: NOW-1WEEK
- the start of current hour: /HOUR
- the start of current year: /YEAR
The date units are: YEAR, YEARS, MONTH, MONTHS, DAY, DAYS, DATE, HOUR, HOURS, MINUTE, MINUTES, SECOND, SECONDS, MILLI, MILLIS, MILLISECOND, MILLISECONDS (the plural, singular, and abbreviated forms refer to the same unit).
Let's see how to apply it in Europeana's context.
From xxx up until now
Syntax: timestamp_created:[xxx TO NOW]
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&&query=timestamp_created:%5B2014-05-01T00:00:00.000Z+TO+NOW%5D
Test on API Console
From xxx up until yesterday
Syntax: timestamp_created:[xxx TO NOW-1DAY]
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&&query=timestamp_created:%5B2014-05-01T00:00:00.000Z+TO+NOW-1DAY%5D
Test on API Console
Changes in the last two months
Syntax: [NOW-2MONTH/DAY TO NOW/DAY]
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&&query=timestamp_created:%5BNOW-2MONTH/DAY+TO+NOW/DAY%5D
Test on API Console
You can find more about data mathematics at Solr's API documentation
Query Refinements
So far we have dealt with examples where there was only one query term. Sometimes it is useful to split a query into a variable and a constant part. For instance, for an application that accesses only objects located in London, it is possible to have the constant part of the query pre-selecting London-based objects and the variable part selecting objects within this pre-selection.
This can be done using the refinement parameter qf which is appended to the query parameter. This example looks for objects which contain the term Westminster and their location is in London:
https://api.europeana.eu/record/v2/search.json?wskey=xxxx&query=Westminster&qf=where:London
Test on API Console
Refinement parameters can be concatenated. Each such parameter and the mandatory query parameter contributes a breadcrumb object if breadcrumbs are specified in the search profile.