Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@craftercms/search

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@craftercms/search

Crafter CMS search service and associated tools

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
171
decreased by-10.94%
Maintainers
3
Weekly downloads
 
Created
Source

@craftercms/search

This package contains tools for integrating your application with Crafter Search.

Usage

  • Install module using yarn or npm
    • Yarn: yarn add @craftercms/search
    • npm: npm install @craftercms/search
  • Import and use the service(s) you need

Services


Returns the result for a given query.

search(query: Query)

Parameters
queryThe query object
configCrafter configuration. Optional. Default value in here.

Returns

Map model

Examples

  • Connect to Crafter Search to query for content with ELASTIC SEARCH (crafter version: 3.1.x):
  import { crafterConf } from '@craftercms/classes';
  import { SearchService } from '@craftercms/search';

  //First, set the Crafter configuration to _cache_ your config. 
  //All subsequent calls to `getConfig` will use that configuration.
  crafterConf.configure({
    baseUrl: 'http://localhost:8080'
    site: 'editorial'
  });

  //Create elastic query
  const query = SearchService.createQuery('elasticsearch');
  query.query = {
    "query" : {
        "match_all" : {}
    }
  }

  SearchService
    .search(query)
    .subscribe(results => {
      // ...
    });
  • Connect to Crafter Search to query for content with SOLR (crafter version: 3.0.x):
  import { crafterConf } from '@craftercms/classes';
  import { SearchService } from '@craftercms/search';

  //First, set the Crafter configuration to _cache_ your config. 
  //All subsequent calls to `getConfig` will use that configuration.
  crafterConf.configure({
    baseUrl: 'http://localhost:8080'
    site: 'editorial',
    searchId: 'editorial'   // if searchId is the same as site, this parameters is not needed
  })

  const query = SearchService.createQuery('solr');
  query.query = "*:*";
  query.filterQueries = ['content-type:"/component/video"'];

  SearchService
    .search(query)
    .subscribe(results => {
      // ...
    });

You may alternatively use a different config by supplying the config object at the service call invoking time

  import { SearchService } from '@craftercms/search';

  //Create query
  const query = SearchService.createQuery('elasticsearch');
  query.query = {
    "query" : {
        "match_all" : {}
    }
  }

  SearchService
    .search(query, {
      baseUrl: 'http://localhost:8080',
      site: 'editorial'
    })
    .subscribe(results => {
      // ...
    });

Keywords

FAQs

Package last updated on 29 May 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc