Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
Rajarshi Guha edited this page Nov 8, 2013 · 18 revisions

All resource support retrieval of information based on entity identifiers. Structure search is supported as a feature of the /compounds resource.

Full text searching of entities is supported by the /search resource and employs Solr on the backend. This resource supports full text searches on individual entities (assays, compounds and projects). In addition the top level resource supports querying over all entities simultaneously. Examples include

Query for the term "dna repair" within the assay resource : http://bard.nih.gov/api/latest/search/assays?q="dna repair"

Query for the term "dna repair" across all resources : http://bard.nih.gov/api/latest/search?q="dna repair"

Level of detail

By default search results are minimalistic in terms of the hits they return. Specifically, sn entity will be described by its identifier and one or two extra fields. To get a more detailed response append &expand=true to the URL

Filtering results

The basic full text search will return a response containing one or more Solr documents. These documents include a selected subset of the explicit information associated with an entity (e.g., assay id and title for an assay entity) as well as related information from other sources. Examples include CAP annotations, GO term assignments, Pubmed DOI's etc.

The /search resource supports filtering of query results based on the value of one or more fields. Such field based query filters be specified using the following syntax

filter=fq(field_name:"field_value"),fq(field_name:"field_value"),

Note the terminating comma - this is important! In addition the field_value item must be double quoted. As an example we could filter our query for "dna repair" based on a GO biological process using the following query: [http://bard.nih.gov/api/latest/search/assays?q="dna repair"&filter=fq(gobp_term:"DNA replication"),](http://bard.nih.gov/api/latest/search/assays?q="dna repair"&filter=fq(gobp_term:"DNA replication"),)

In addition, if multiple filter queries are specified using the same field, the field values are OR'ed together. If the fields are different, then the query fields are AND'ed together.

[http://bard.nih.gov/api/latest/search/assays/fields] (http://bard.nih.gov/api/latest/search/assays/fields)

[http://bard.nih.gov/api/latest/search/compounds/fields] (http://bard.nih.gov/api/latest/search/compounds/fields)

[http://bard.nih.gov/api/latest/search/projects/fields] (http://bard.nih.gov/api/latest/search/projects/fields)

Facets

The search response includes facet information, using a pre-defined set of fields. Currently, the facet information includes all values for a facet - even when the count for that value is zero. An excerpt from the facet section of a search response (on the assay resource) is shown below

...
{
 facetName: "detection_method_type",
 counts: {
  spectrophotometry method: 7,
  label-free method: 8,
  image-based: 6,
  fluorescence method: 2,
  electrophysiology method: 3,
  imaging method: 3,
  radiometry method: 3,
  luminescence method: 6
 }
},
...

The facet information can be used to filter results using the filter query syntax described above. The facetName field should be used as the field name and on the of the labels in the counts field should be used as the field value

Auto complete

The /search resource provides an autocomplete (or autosuggest) facility. This allows you to specify a phrase or a word fragment and obtain a list of matching terms from the fields supported for a given entity. Currently this is supported for the assay, compound and project entities. By default, 10 hits are returned for each field that has a non-zero count of matching terms. Examples include

http://bard.nih.gov/api/latest/search/assays/suggest?q=res

http://bard.nih.gov/api/latest/search/assays/suggest?q=response

[http://bard.nih.gov/api/latest/search/assays/suggest?q=dna] (http://bard.nih.gov/api/latest/search/assays/suggest?q=dna)

[http://bard.nih.gov/api/latest/search/assays/suggest?q=dna&top=5] (http://bard.nih.gov/api/latest/search/assays/suggest?q=dna&top=5)

[http://bard.nih.gov/api/latest/search/assays/suggest?q=dna re] (http://bard.nih.gov/api/latest/search/assays/suggest?q=dna re)

The autosuggest facility is case insensitive and currently uses the supplied query as a prefix when searching. Only fields that have matching values will show up in the response. For a given field, the terms are ordered in descending order of their frequency of occurrence in the document index. The time required to obtain a set of suggestions is currently less than 100ms in nearly all cases.