All Projects β†’ arso-project β†’ sonar-tantivy

arso-project / sonar-tantivy

Licence: MIT License
Search engine based on tantivy with a Node.js frontend

Programming Languages

rust
11053 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects
powershell
5483 projects

Projects that are alternatives of or similar to sonar-tantivy

lnx
⚑ Insanely fast, 🌟 Feature-rich searching. lnx is the adaptable, typo tollerant deployment of the tantivy search engine. Standing on the shoulders of giants.
Stars: ✭ 844 (+2713.33%)
Mutual labels:  search-engine, tantivy
openverse-api
The Openverse API allows programmatic access to search for CC-licensed and public domain digital media.
Stars: ✭ 41 (+36.67%)
Mutual labels:  search-engine
module-search-mysql-legacy
No description or website provided.
Stars: ✭ 52 (+73.33%)
Mutual labels:  search-engine
bitshift
A semantic search engine for source code
Stars: ✭ 30 (+0%)
Mutual labels:  search-engine
starter
Create vertical search web application in minutes with generator (based on ItemsAPI)
Stars: ✭ 21 (-30%)
Mutual labels:  search-engine
Free-Internet-Plugin
A free Internet is a better Internet. This Chrome browser plugin removes paywalled content from Google search results.
Stars: ✭ 121 (+303.33%)
Mutual labels:  search-engine
Horizon
A ZeroNet search engine
Stars: ✭ 15 (-50%)
Mutual labels:  search-engine
open-semantic-desktop-search
Virtual Machine for Desktop Search with Open Semantic Search
Stars: ✭ 22 (-26.67%)
Mutual labels:  search-engine
bing-ip2hosts
bingip2hosts is a Bing.com web scraper that discovers websites by IP address
Stars: ✭ 99 (+230%)
Mutual labels:  search-engine
vim-www
Toolbox to open & search URLs from vim
Stars: ✭ 32 (+6.67%)
Mutual labels:  search-engine
dotnetlive.search
Asp.Net Core + ElasticSearch
Stars: ✭ 18 (-40%)
Mutual labels:  search-engine
indexer4j
Simple full text indexing and searching library for Java
Stars: ✭ 47 (+56.67%)
Mutual labels:  search-engine
collector-filesystem
Norconex Filesystem Collector is a flexible crawler for collecting, parsing, and manipulating data ranging from local hard drives to network locations into various data repositories such as search engines.
Stars: ✭ 17 (-43.33%)
Mutual labels:  search-engine
flow-indexer
Flow-Indexer indexes flows found in chunked log files from bro,nfdump,syslog, or pcap files
Stars: ✭ 43 (+43.33%)
Mutual labels:  search-engine
openverse-catalog
Identifies and collects data on cc-licensed content across web crawl data and public apis.
Stars: ✭ 27 (-10%)
Mutual labels:  search-engine
lupyne
Pythonic search engine based on PyLucene.
Stars: ✭ 61 (+103.33%)
Mutual labels:  search-engine
evildork
Evildork targeting your fianceeπŸ‘οΈ
Stars: ✭ 46 (+53.33%)
Mutual labels:  search-engine
see
Search Engine in Erlang
Stars: ✭ 27 (-10%)
Mutual labels:  search-engine
cang-jie
Chinese tokenizer for tantivy, based on jieba-rs
Stars: ✭ 48 (+60%)
Mutual labels:  tantivy
Search Ads Web Service
Online search advertisement platform & Realtime Campaign Monitoring [Maybe Deprecated]
Stars: ✭ 30 (+0%)
Mutual labels:  search-engine

sonar

A tantivy based search engine for Node.js

Example

const Sonar = require('@archipel/sonar')

(async function () {
  const catalog = new Sonar('./data')
  const schema = getSchema()
  const index = await catalog.openOrCreate('index-name', schema)
  const docs = getDocs()
  await index.add(docs)
  const results = await index.query('world')
  console.log('query results', results)
})()

function getDocs () {
  return [
    { id: '0', title: 'Hello world!', body: 'tell me more' },
    { id: '1', title: 'Ola mundo!', body: 'que pasa pues' }
  ]
}

function getSchema () {
  return [
    {
      name: 'title',
      type: 'text',
      options: {
        indexing: { record: 'position', tokenizer: 'en_stem' },
        stored: true
      }
    },
    {
      name: 'body',
      type: 'text',
      options: {
        indexing: { record: 'position', tokenizer: 'en_stem' },
        stored: true
      }
    },
    {
      name: 'id',
      type: 'text',
      options: { indexing: null, stored: true }
    },
  ]
}

Installation

npm install @archipel/sonar

A postinstall script automatically tries to download a precompiled binary for the rust/tantivy part. If unsuccessfull the script will try to compile it if a rust toolchain is present.

API

const catalog = new Sonar(storage)

storage is a file system path where the index will be stored.

const index = await catalog.openOrCreate(indexName, schema)

indexName is a string to identifiy the index. It should only contain characters valid in file system paths. schema is the index schema, expressed as a JSON-serializable object following the tantivy schema definition. Documentation is not centralized atm, see example above.

const index = await catalog.create(indexName, schema, opts)

Create an index. Will throw if an index by this indexName exists already. opts are:

  • ram: If true create an in-memory index

await index.add(docs)

docs is an array of documents with the same structure as the index schema.

const results = await index.query(query, [limit], [snippetField])

Query the index. At the moment only string queries are supported, see tantivy docs for details on the supported grammar. limit is the max number of documents to return (default 10). snippetField is the name of a field for which to return a result snippet with keywords highlighted (as HTML, with <b> tags)

const results = await catalog.multiQuery(query, indexes)

Query all indexes in the catalog. indexes is an array of index names.

To be expanded

Implementation details

The rust part is a wrapper around tantivy. It compiles to a binary. The binary is invoked with a storage path as only argument. It listens for newline-delimited JSON messages on STDIN, and replies in the same format.

The node part spawns the rust binary and communicates over the STDIO pipe. It adds a higher-level API around this simple RPC mechanism.

A npm postinstall step will try to download a precompiled binary of the rust part from Github releases. The binaries are compiled and deployed via Travis. If it cannot find a matching binary, it will try to compile if a rust toolchain is available. If the environment variable RUST_ENV=development is present, cargo run (without --release) will be invoked instead.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].