MyNixOS website logo
Description

R to Solr Interface.

A comprehensive R API for querying Apache Solr databases. A Solr core is represented as a data frame or list that supports Solr-side filtering, sorting, transformation and aggregation, all through the familiar base R API. Queries are processed lazily, i.e., a query is only sent to the database when the data are required.

Description

The `rsolr` package is an idiomatic R interface to Solr based on deferred evaluation. A Solr core is represented as a data frame or list that supports Solr-side filtering, sorting, transformation and aggregation, all through the familiar base R API. Queries are processed lazily, i.e., a query is only sent to the database when the data are required.

Features

  • Store, retrieve and compute on data with Solr, from R
  • Use familiar R syntax and function names from the base R API, with some extensions
  • Model data as either a data.frame or list, or use the low-level query API
  • Conveniently manipulate document collections after retrieval
  • Autogenerate a Solr schema from a data.frame
  • Experiment with the embedded Solr instance
  • Extend to support additional/custom Solr features

Example using data from R

This is inspired by some manipulations in the dplyr vignette.

Load the New York City 2013 flight data and upload to Solr:

library(nycflights13)
schema <- deriveSolrSchema(flights)
solr <- rsolr:::TestSolr(schema)
sr <- SolrFrame(solr$uri)
sr[] <- flights

Filtering:

subset(sr, month == 1 & day == 1)
head(sr, 10L)

Sorting:

sort(sr, by = ~ year + month + day)

Select fields:

subset(sr, select=c(year, month, day))
sr[c("year", "month", "day")]
sr[c("arr_*", "dep_*")] # Solr globs

Transform:

sr2 <- transform(sr,
                 gain = arr_delay - dep_delay,
                 speed = distance / air_time * 60)
sr2[c("gain", "speed")]

Aggregate:

unique(sr["tailnum"])
aggregate(~ tailnum, sr,
          count = TRUE,
          dist = mean(distance, na.rm=TRUE),
          delay = mean(arr_delay, na.rm=TRUE))

Example using existing Solr core

Construct a SolrFrame using the URL to the existing core:

sr <- SolrFrame("http://my.host.com/solr/mycore")
	

Convert the SolrFrame to a data.frame, typically after some filtering or aggregation:

df <- as.data.frame(sr)
Metadata

Version

0.0.13

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows