vfb_solr_query: Query VFB via solr indexing system

Description Usage Arguments Details Value See Also Examples

View source: R/vfb_query.R

Description

Solr provides an extremely fast way to query all key content on VFB and is the backend used for most queries run on the website. It is pre-populated from the OWL ontology documents describing all the information on the site and their relationships. More details on Solr and its query syntax can be found at http://lucene.apache.org/solr/.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
vfb_solr_query(
  query = "*:*",
  filterquery = NULL,
  fields = "label+short_form",
  sort = "score+desc",
  defaultfield = "short_form",
  rows = 30L,
  path = "solr/ontology/select?wt=json",
  server = getOption("vfbr.server.solr"),
  parse.json = TRUE,
  ...
)

Arguments

query

A key-value list specifying the query

filterquery

A character vector (of length one or more) describing filter queries for solr (see Details for regular vs filter queries)

fields

Which fields to return (+delimited). A value of "" implies all fields.

sort

Character vector naming one or more fields (+ delimited) to use for sorting the results.

defaultfield

Character vector naming default field used for filter queries (defaults to short_form)

rows

Maximum number of rows to return. The special value of Inf implies all matching rows.

path

The path on the server containing the query page

server

The base url of the server

parse.json

Whether or no to parse the response (default: TRUE)

...

additional solr query arguments

Details

The query arguments maps onto the general solr q= query while filterqueries maps onto one or more fl= terms. The solr wiki says this about the difference:

The fq parameter defines a query that can be used to restrict the superset of documents that can be returned, without influencing score. It can be very useful for speeding up complex queries, since the queries specified with fq are cached independently of the main query. When a later query uses the same filter, there's a cache hit, and filter results are returned quickly from the cache.

Value

When parse.json=TRUE, a data.frame containing the parsed response (originally the response$docs field in the parsed JSON) along with additional attributes including

When parse.json=FALSE an httr::response object

See Also

response

Other query: vfb_neo4j_query(), vfb_owl_query()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Find VFB ids matching a given GMR line
# note the field synonym_autosuggest will in future be the only one
# matching GMR* ids
vfb_solr_query(filterquery="VFB_*",query="synonym_autosuggest:GMR_10A07*")

# Find VFB ids matching a given VT Gal4 line
vfb_solr_query(filterquery="VFB_*",query="label:VT017929*")

# how many GMR lines can we find
# note use of rows = 0 so we do not fetch results (but still get totals)
r=vfb_solr_query(filterquery="VFB_*",query="label:GMR_*", rows=0)
attr(r,'numFound')

#' # VFB id for all GMR lines
all_gmr=vfb_solr_query(filterquery="VFB_*",query="label:GMR_*", rows=4000)
head(all_gmr)

# VFB id for all FlyCircuit neurons
# note use of rows=Inf to fetch all rows
all_fc=vfb_solr_query(filterquery="VFB_*",
  query="source_data_link_annotation:*flycircuit*", rows=Inf)
head(all_fc)

jefferis/vfbr documentation built on Feb. 17, 2021, 4:46 p.m.