All Projects β†’ netgen β†’ Query Translator

netgen / Query Translator

Licence: mit
Query Translator is a search query translator with AST representation

Projects that are alternatives of or similar to Query Translator

Csstree
A tool set for CSS including fast detailed parser, walker, generator and lexer based on W3C specs and browser implementations
Stars: ✭ 1,121 (+579.39%)
Mutual labels:  ast, parser, generator
Php Parser
🌿 NodeJS PHP Parser - extract AST or tokens (PHP5 and PHP7)
Stars: ✭ 400 (+142.42%)
Mutual labels:  ast, tokenizer, parser
Code4java
Repository for my java projects.
Stars: ✭ 164 (-0.61%)
Mutual labels:  solr, elasticsearch
Baba Core
Mini-language for creating random text generators.
Stars: ✭ 127 (-23.03%)
Mutual labels:  parser, generator
Elasticsearch tutorial
An action-packed, example-based ElasticSearch tutorial
Stars: ✭ 133 (-19.39%)
Mutual labels:  search, elasticsearch
Lucenenet
Apache Lucene.NET
Stars: ✭ 1,704 (+932.73%)
Mutual labels:  search, query
Transformalize
Configurable Extract, Transform, and Load
Stars: ✭ 125 (-24.24%)
Mutual labels:  solr, elasticsearch
Babylon
PSA: moved into babel/babel as @babel/parser -->
Stars: ✭ 1,692 (+925.45%)
Mutual labels:  ast, parser
Haystack
πŸ” Haystack is an open source NLP framework that leverages Transformer models. It enables developers to implement production-ready neural search, question answering, semantic document search and summarization for a wide range of applications.
Stars: ✭ 3,409 (+1966.06%)
Mutual labels:  search, elasticsearch
Elasticsearch Ruby
Ruby integrations for Elasticsearch
Stars: ✭ 1,848 (+1020%)
Mutual labels:  search, elasticsearch
Vue Innersearch
πŸ”Ž UI components built with Vue.js for ElasticSearch
Stars: ✭ 135 (-18.18%)
Mutual labels:  search, elasticsearch
Laravel Api Handler
Package providing helper functions for a Laravel REST-API
Stars: ✭ 150 (-9.09%)
Mutual labels:  search, query
Elassandra
Elassandra = Elasticsearch + Apache Cassandra
Stars: ✭ 1,610 (+875.76%)
Mutual labels:  search, elasticsearch
Ext Solr
A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.
Stars: ✭ 118 (-28.48%)
Mutual labels:  search, solr
Phplrt
PHP Language Recognition Tool
Stars: ✭ 127 (-23.03%)
Mutual labels:  ast, parser
Luqum
A lucene query parser generating ElasticSearch queries and more !
Stars: ✭ 118 (-28.48%)
Mutual labels:  parser, elasticsearch
Works For Me
Collection of developer toolkits
Stars: ✭ 131 (-20.61%)
Mutual labels:  tokenizer, parser
Lioness
The Lioness Programming Language
Stars: ✭ 155 (-6.06%)
Mutual labels:  ast, parser
Ik Analyzer
ζ”―ζŒLucene5/6/7/8+η‰ˆζœ¬, ι•ΏζœŸη»΄ζŠ€γ€‚
Stars: ✭ 112 (-32.12%)
Mutual labels:  solr, elasticsearch
Srchx
A standalone lightweight full-text search engine built on top of blevesearch and Go with multiple storage (scorch, boltdb, leveldb, badger)
Stars: ✭ 118 (-28.48%)
Mutual labels:  solr, elasticsearch

Query Translator

Build Status Code Coverage Downloads Latest stable License PHP

Query Translator takes a search string as user input and converts it into something a search backend can understand. Technically, it's a search query translator with abstract syntax tree representation. From the produced syntax tree, translation target can be anything you need. Usually it's a search backend, like Solr and Elasticsearch, or a database abstraction layer.

A set of interfaces for implementing a language processor is provided, with a single implemented language named Galach. Galach implements a syntax that is based on what seems to be the unofficial standard for search query as user input. Quick cheat sheet:

word "phrase" (group) +mandatory -prohibited AND && OR || NOT ! #tag @user domain:term

Error handling

User input means you have to expect errors and handle them gracefully. Because of that, the parser is completely resistant to errors. Syntax tree will contain detailed information about corrections applied to make sense of the user input. This can be useful to clean up the input or implement rich input interface, with features like suggestions, syntax highlighting and error feedback.

Customization

The implementation was made with customization in mind. You can change the special characters which will be used as part of the syntax, pick out elements of the language you want to use, implement your own term clauses, or change how the syntax tree is converted to the target output.

Some use cases

  • User-level query language on top of your search backend
  • Common query language on top of different search backends
  • Control over options of the query language that is already provided by the search backend
  • Better error handling than provided by the search backend
  • Analysis and manipulation of the query before sending to the backend
  • Customized query language (while remaining within the base syntax)
  • Implementing rich input interface (with suggestions, syntax highlighting, error feedback)

Note: This implementation is intended as a library, meaning it doesn't try to solve specific use cases for query translation. Instead, it's meant to be a base that you can use in implementing such a use case.

How to use

First add the library to your project:

composer require netgen/query-translator:^1.0

After that, make use of the features provided out of the box. If those are not enough, use extension points to customize various parts of the translator to fit your needs. See Galach documentation to find out more.

Run the demo

Demo is available as a separate repository at netgen/query-translator-demo.

Steps for running the demo:

  1. Create the demo project using composer composer create-project netgen/query-translator-demo
  2. Position into the demo project directory cd query-translator-demo
  3. Start the web server with src as the document root php -S localhost:8005 -t src
  4. Open http://localhost:8005 in your browser Query Translator demo
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].