Query Parser
Project description
qparser
A Query Parser
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
Release history Release notifications | RSS feed
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.1a3.tar.gz
(4.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qparser-0.1a3.tar.gz.
File metadata
- Download URL: qparser-0.1a3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
356656cd11974f0aa4e9c21b53208ee8e7d4183390bd4b6fc201beb87ad47b7a
|
|
| MD5 |
de349b945e6cbb639d89323ae1d070d4
|
|
| BLAKE2b-256 |
83a072ffc5a68f84172347152c313d9bc8d12c4649c7b97aeb35a2f86f71ea11
|
File details
Details for the file qparser-0.1a3-py3-none-any.whl.
File metadata
- Download URL: qparser-0.1a3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e47e0acba8baa335f095c66671212cdeea2bec7b59bbdb27a6a200dddcdbcd43
|
|
| MD5 |
220242d1298d254115410fcc36decee1
|
|
| BLAKE2b-256 |
08649a135339af0d68fcdb7ebc84b750c8b3a85eee64e093ef16714e1278e8ff
|