Comment on page
searchquery parameter finds results that match a given text search. Example:
When you search
works, the API looks for matches in titles, abstracts, and fulltext. When you search
concepts, we look in each concept's
descriptionfields. When you search
sources, we look at the
abbreviated_titlefields. When you search
authors, we look at the
display_name_alternativesfields. When you search
institutions, we look at the
For most text search we remove stop words and use stemming (specifically, the Kstem token filter) to improve results. So words like "the" and "an" are transparently removed, and a search for "possums" will also return records using the word "possum." With the exception of raw affiliation strings, we do not search within words but rather try to match whole words. So a search with "lun" will not match the word "lunar".
Including any of the words
NOTin any of your searches will enable boolean search. Those words must be UPPERCASE. You can use this in all searches, including using the
searchparameter, and using search filters.
This allows you to craft complex queries using those boolean operators along with parentheses and quotation marks. Surrounding a phrase with quotation marks will search for an exact match of that phrase, after stemming and stop-word removal (be sure to use double quotation marks —
"). Using parentheses will specify order of operations for the boolean operators. Words that are not separated by one of the boolean operators will be interpreted as
Behind the scenes, the boolean search is using Elasticsearch's query string query on the searchable fields (such as title, abstract, and fulltext for works; see each individual entity page for specifics about that entity). Wildcard and fuzzy searches using
~are not allowed; these characters will be removed from any searches. These searches, even when using quotation marks, will go through the same cleaning as desscribed above, including stemming and removal of stop words.
When you use search, each returned entity in the results lists gets an extra property called
relevance_score, and the list is by default sorted in descending order of
relevance_scoreis based on text similarity to your search term. It also includes a weighting term for citation counts: more highly-cited entities score higher, all else being equal.
If you search for a multiple-word phrase, the algorithm will treat each word separately, and rank results higher when the words appear close together. If you want to return only results where the exact phrase is used, just enclose your phrase within quotes. Example:
- Get works with the words "fierce" and "creatures" in the title or abstract, with works that have the two words close together ranked higher by
relevance_score(returns way more results):
You might be tempted to use the search filter to power an autocomplete or typeahead. Instead, we recommend you use the autocomplete endpoint, which is much faster. 👎