Skip to content

ENCODE-DCC/snovault-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI Coverage Status

snovault-search

Framework-independent package for converting query strings to Elasticsearch queries.

Install

$ pip install snovault-search

Example

from snosearch.defaults import DEFAULT_ITEM_TYPES
from snosearch.fields import BasicSearchResponseField
from snosearch.parsers import ParamsParser
from snosearch.responses import FieldedResponse


def basic_search_view(request):
    fr = FieldedResponse(
        _meta={
            'params_parser': ParamsParser(request)
        },
        response_fields=[
            BasicSearchResponseField(
                default_item_types=DEFAULT_ITEM_TYPES
            )
        ]
    )
    return fr.render()

Run tests

$ pip install -e .[test]
$ pytest

Publish on PyPI

Bump version in setup.cfg, then build and upload:

$ python -m build
$ twine upload dist/*