The Index¶
In order to find objects in the database CHAOS uses Solr.
Solr is a search engine to which you can send search queries. Solr uses an Index for searching. The index has a number of fields.
The query argument of the Object/Get action passes its value on to Solr as a search string.
Fields present in the Solr Index are called indexed fields.
Solr query syntax¶
Let’s say that a field named Title is indexed in Solr.
We could then search for hest by using the search string Title:hest.
In CHAOS it looks like this: http://api.danskkulturarv.dk/Object/Get?accessPointGUID=7A06C4FF-D15A-48D9-A908-088F9796AF28&pageSize=5&query=Title:hest
There is no Title field in the CHAOS Solr index so we get an error.
There is, however, a field called DKA-Title_string, so we can do a succesfull search like this: http://api.danskkulturarv.dk/Object/Get?accessPointGUID=7A06C4FF-D15A-48D9-A908-088F9796AF28&pageSize=5&query=DKA-Title_string:hest
To combine searches in multiple fields, Solr provides the operators AND and OR. You use by inserting them (with spaces) between field searches: field1:search_value1 OR field2:search_value2
Note
You cannot have space-characters in a URL. In a URL spaces are represented with either + or %20.
Here we search for objects with either hest or ukendt in their title: http://api.danskkulturarv.dk/Object/Get?accessPointGUID=7A06C4FF-D15A-48D9-A908-088F9796AF28&pageSize=5&query=DKA-Title_string:hest+OR+DKA-Title_string:ukendt
Spaces (without any operator) are interpreted as OR: http://api.danskkulturarv.dk/Object/Get?accessPointGUID=7A06C4FF-D15A-48D9-A908-088F9796AF28&pageSize=5&query=DKA-Title_string:hest+DKA-Title_string:ukendt
AND cannot be omitted.
Indexed fields in CHAOS¶
In general there is no specification of what fields are indexed in CHAOS – this up to the database administrator.
However you can expect metadata to be indexed in the following way:
m<MetadataSchemaGUID>_<LanguageCode>_all
Searching this field will search through all metadata that has the specified LanguageCode and MetadataSchemaGUID. You can use this search field to search for objects in a meaningful way, because you will typically have a single MetadataSchema that defines how the title, description and so on should be given. Thus by searching the correct MetadataSchemaGUID you can search the title and description of objects.