Skip to main content

Query Parser

Project description

qparser

A Query Parser

Build Status Package version

Usage

from qparser import query 
terms = query("bob AND alice")

Syntax

query = and | or | not | near | has | sequence | exact | token
and = query "AND" query | "{" query { query } "}"
or = query "OR" query | "[" query { query } "]"
not = "NOT" query | "!" query
has = "HAS" query
near = query "NEAR" query
sequence = query { query } | "(" query { query } ")"
exact = "'" query { query } "'" | '"' query { query } '"'
token = character { character }
character = ! ( "AND" | "OR" | "NOT" | "NEAR" | "HAS" | "!" | "{" | "}" | "(" | ")" | "[" | "]" | "'" | '"' | space )
space = " "

Examples

Query Matches
bob AND alice Bob sent a message to Alice
bob OR alice Alice received a message
bob NOT alice Bob sent a message
bob NEAR alice Bob and Alice corresponded
bob HAS movie Bob, Alice, and Carol went to the movies
bob AND alice AND carol Bob and Alice sent a message that Carol intercepted
a message AND alice Bob sent a message to Alice
[ bob alice ] AND carol Alice didn't send the message to Carol
bob sent AND alice received Bob sent a message that Alice received

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qparser-0.1a2.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

qparser-0.1a2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file qparser-0.1a2.tar.gz.

File metadata

  • Download URL: qparser-0.1a2.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for qparser-0.1a2.tar.gz
Algorithm Hash digest
SHA256 02c1893f440d80d45fe75302fb19524ba51b0dcc229bc9bcd7486d03ac12adb4
MD5 cd0b817a61eea680ff3aa9611910e66a
BLAKE2b-256 4f57c11dbbd032de32f73731baa9bc9bf7085648d6d9f235c75e7a2a1487aae1

See more details on using hashes here.

File details

Details for the file qparser-0.1a2-py3-none-any.whl.

File metadata

  • Download URL: qparser-0.1a2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for qparser-0.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 b314faca4be9ee52994ddedc5038228af0c38d07e4a497ce3fbe5764c2a65ff4
MD5 93dfce44af6e1c3e9a6fb8c11970c1b1
BLAKE2b-256 c668e99a2c7646868c07561406650f7ee977133b0d973ce7fc2249475e7c461b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page