New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

apollo-link-algolia

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-link-algolia

Query Algoila with Apollo

0.0.5
latest
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

This is heavly work in progress!

apollo-link-algolia provides you a simple way to query Algolia in graphQL with apollo-client without building a graphQL server.

Currently, we support features below:

  • Query parameters: list of supported parametes can be checked here.

Contents

Installation

npm install --save apollo-link-algolia
# or if you're using yarn
yarn add apollo-link-algolia

Usage

Basic

To get the results of your request, query for hits field

const algoliaClient = algoliasearch('APPLICATION_ID', 'API_KEY')

const algoliaLink = new AlgoliaLink({ client: algoliaClient })

const client = new ApolloClient({
  link: algoliaLink,
  cache: new InMemoryCache()
})

const LOCATIONS_QUERY = gql`
  query LocationsQuery {
    locationsInRadius @algolia(index: "INDEX_NAME", aroundLatLng: "40.71, -74.01", aroundRadius: 1000) {
        hits
    }
  }


client.query({ query: LOCATIONS_QUERY }).then(response => console.log(response))

Query meta fields

Aside from the hits field, the result may contain several other fields that contain meta information:

  • aroundLatLng
  • automaticRadius
  • disjunctiveFacets
  • exhaustiveFacetsCount
  • exhaustiveNbHits
  • facets
  • hierarchicalFacets
  • hitsPerPage
  • index
  • nbHits
  • nbPages
  • page
  • parsedQuery
  • processingTimeMS
  • query
  • queryID
  • serverUsed
  • timeoutCounts
  • timeoutHits
  • userData
  • _rawResults
  • _state

Keywords

algolia

FAQs

Package last updated on 26 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts