Really simple django-app for search by Q-expressions
Project description
# django-silly-search
Simple django-app for search by Q-expressions.
[![Build Status](https://travis-ci.org/Egregors/django-silly-search.svg?branch=master)](https://travis-ci.org/Egregors/django-silly-search)
If you need the simple way to search, without full-text,
morphology features, this app may be useful. But, if you need search for more
complicated case, you should use something like [Haystack](http://haystacksearch.org/)
## Features
* Search for one or few models
* Search for multiple fields
## Install
Clone this repo and install from the source:
```
git clone https://github.com/Egregors/django-silly-search.git
cd django-silly-search
pip install -e .
```
or just use PyPI
```
pip install django-silly-search
```
## How to use
The app provides a single function:
```
from silly_search import q_search
# q_search(models, fields, q) -> QuerySet
```
The functions takes required arguments:
`models` – Models for search. Should be instance of `ModelBase` (regular Model)
or `list` of `ModelBase` instances
`fields` – Fields for search. Should be `str` or `list` of `str` (just name of models field)
`q` – phrase for search. Should be an `str`
## Example
Let's say you have Models:
```
class Article(models.Model):
title = models.CharField(max_length=128)
description = models.CharField(max_length=255)
text = models.TextField()
class News(models.Model):
pub_date = models.DateTimeField(auto_now_add=True)
title = models.CharField(max_length=128)
text = models.TextField()Z
```
and you want to make search on these models. So, you can search for one model and one field:
```
q_search(Article, 'title', q='spam')
```
or for one models, but few fields:
```
q_search(Article, fields=['title', 'text'], q='spam')
```
or for few models and few fields:
```
q_search(models=[Article, News], fields=['title', 'description', 'text'], q='spam')
```
## Contributing
Bug reports, bug fixes, and new features are always welcome.
Please open issues, and submit pull requests for any new code.
Simple django-app for search by Q-expressions.
[![Build Status](https://travis-ci.org/Egregors/django-silly-search.svg?branch=master)](https://travis-ci.org/Egregors/django-silly-search)
If you need the simple way to search, without full-text,
morphology features, this app may be useful. But, if you need search for more
complicated case, you should use something like [Haystack](http://haystacksearch.org/)
## Features
* Search for one or few models
* Search for multiple fields
## Install
Clone this repo and install from the source:
```
git clone https://github.com/Egregors/django-silly-search.git
cd django-silly-search
pip install -e .
```
or just use PyPI
```
pip install django-silly-search
```
## How to use
The app provides a single function:
```
from silly_search import q_search
# q_search(models, fields, q) -> QuerySet
```
The functions takes required arguments:
`models` – Models for search. Should be instance of `ModelBase` (regular Model)
or `list` of `ModelBase` instances
`fields` – Fields for search. Should be `str` or `list` of `str` (just name of models field)
`q` – phrase for search. Should be an `str`
## Example
Let's say you have Models:
```
class Article(models.Model):
title = models.CharField(max_length=128)
description = models.CharField(max_length=255)
text = models.TextField()
class News(models.Model):
pub_date = models.DateTimeField(auto_now_add=True)
title = models.CharField(max_length=128)
text = models.TextField()Z
```
and you want to make search on these models. So, you can search for one model and one field:
```
q_search(Article, 'title', q='spam')
```
or for one models, but few fields:
```
q_search(Article, fields=['title', 'text'], q='spam')
```
or for few models and few fields:
```
q_search(models=[Article, News], fields=['title', 'description', 'text'], q='spam')
```
## Contributing
Bug reports, bug fixes, and new features are always welcome.
Please open issues, and submit pull requests for any new code.
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
Built Distribution
Close
Hashes for django-silly-search-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c49ef6bb1afe24fdcc7c9123c16be694eebe4f00031f32683ca002ff0714f51 |
|
MD5 | 43e9147902868e31a69351a3bed4975b |
|
BLAKE2b-256 | 7f7054209859bd7a7255d945ed8e608f904592bd43cea4340ea777905adf3a8b |
Close
Hashes for django_silly_search-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3acb1c51ed408c4050da7db555b389a3d4a6e0feec96ef663cbe07cd77d97b0b |
|
MD5 | fc50134d58926061d0f7c69e76c76cc8 |
|
BLAKE2b-256 | 28493211c3f536836c45e16d77d36fd3b82194899e21f22f0e1351e411dfb4c2 |