Skip to main content

A search query parser that works in conjunction with haystack

Project description

haystack-queryparser
====================

Converts arbitrarily complicated user entered query strings to a haystack query object.

###Usage
```python
from haystack_queryparser import ParseSQ
```
Also provides or_parser and and_parser which can be directly used with a query
```python
parser = ParseSQ()
sq_object = parser.parse(query)
```
takes a `AND` or `OR` operator to use as default optionally.

###Input
Input should be a string.This the query.

###Output
Output is a `SQ(haystack.query.SQ)` object.
This can be passed to `SearchQuerySet.filter` and the query will be applied

###Test
To run the test you need to be in the django environment.So you can do something like this:
```
$ python manage.py shell
>>> import haystack_queryparser.tests as test
>>> tests.main()
test_operators (modules.haystack_queryparser2.tests.SimpleTest) ... ok
test_parse (modules.haystack_queryparser2.tests.SimpleTest) ... ok
test_parse_with_new_default (modules.haystack_queryparser2.tests.SimpleTest) ... ok

----------------------------------------------------------------------
Ran 3 tests in 0.004s

OK
```

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

haystack_queryparser-0.2.1.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file haystack_queryparser-0.2.1.tar.gz.

File metadata

File hashes

Hashes for haystack_queryparser-0.2.1.tar.gz
Algorithm Hash digest
SHA256 099db7c7f1e109245ccd0a52800a4173f386e927d2ff7d4305fe61b3d7d573d6
MD5 5176c94041016849f0167e203f502f08
BLAKE2b-256 b0a3488fa403b6966946f5e987f0175218f6ae087f8e4379fbff64bc3a046a63

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