{ "info": { "author": "tell-k", "author_email": "ffk2005 at gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Indexing/Search", "Topic :: Software Development :: Libraries" ], "description": "A simple query builder for Amazon Cloudsearch Structured query parser.\r\n\r\n|travis| |coveralls| |downloads| |version| |license| |requires|\r\n\r\n.. contents::\r\n :local:\r\n :depth: 1\r\n\r\nFeatures\r\n========\r\n* Provide a simple query builder for Amazon Cloudsearch Structured query parser.\r\n* Please refer to the following link regarding **Structured Search Syntax** .\r\n\r\n * http://docs.aws.amazon.com/cloudsearch/latest/developerguide/search-api.html\r\n\r\nCaution\r\n========\r\n* At the moment, this library is compatible only to **Structured Search Syntax** .\r\n* It does not have any plans corresponding to the other query parser(lucene, dismax, simple).\r\n* If you want the lucene query builder, it's a good idea is to use the following library.\r\n\r\n * https://pypi.python.org/pypi/lucene-querybuilder\r\n\r\n* This library does not handle to generate queries that are not related to **Structured Search Syntax**. Ex) size, facets ...\r\n\r\nSet up\r\n======\r\n\r\nMake environment with pip::\r\n\r\n $ pip install csquery\r\n\r\nUsage\r\n=====\r\n\r\nand\r\n---\r\n\r\nSyntax: (and boost=N EXPRESSION EXPRESSION ... EXPRESSIONn)\r\n\r\n.. code-block:: python\r\n\r\n from csquery.structured import and_, field\r\n\r\n q = and_(title='star', actors='Harrison Ford', year=('', 2000))\r\n q() #=> (and title:'star' actors:'Harrison Ford' year:{,2000])\r\n\r\n # with option\r\n q = and_({'title': 'star'}, {'title': 'star2'}, boost=2)\r\n q() #=> (and boost=2 title:'star' title:'star2')\r\n\r\n # another writing\r\n and_({'title': 'star'}, {'actors': 'Harrison Ford'}, {'year': ('', 2000)})\r\n and_(field('star', 'title'), field('Harrison Ford', 'actors'), field(('', 2000), 'year'))\r\n\r\nor\r\n---\r\n\r\nSyntax: (or boost=N EXPRESSION1 EXPRESSION2 ... EXPRESSIONn)\r\n\r\n\r\n.. code-block:: python\r\n\r\n from csquery.structured import or_, field\r\n\r\n q = or_(title='star', actors='Harrison Ford', year=('', 2000))\r\n q() #=> (or title:'star' actors:'Harrison Ford' year:{,2000])\r\n\r\n # with option\r\n q = or_({'title': 'star'}, {'title': 'star2'}, boost=2)\r\n q() #=> (or boost=2 title:'star' title:'star2')\r\n\r\n\r\nnot\r\n----\r\n\r\nSyntax: (not boost=N EXPRESSION)\r\n\r\n.. code-block:: python\r\n\r\n from csquery.structured import not_, and_\r\n\r\n q = not_(and_(actors='Harrison Ford', year=('', 2010)))\r\n q() #=> (not (and actors:'Harrison Ford' year:{,2010]))\r\n\r\n # with option\r\n q = not_(and_(actors='Harrison Ford', year=('', 2010)), boost=2)\r\n q() #=> (not boost=2 (and actors:'Harrison Ford' year:{,2010]))\r\n\r\nnear\r\n-----\r\n\r\nSyntax: (near field=FIELD distance=N boost=N 'STRING')\r\n\r\n.. code-block:: python\r\n\r\n from csquery.structured import near\r\n\r\n q = near('teenage vampire', boost=2, field='plot', distance=2)\r\n q() #=> (near field=plot distance=2 boost=2 'teenage vampire')\r\n\r\nphrase\r\n-------\r\n\r\nSyntax: (phrase field=FIELD boost=N 'STRING')\r\n\r\n.. code-block:: python\r\n\r\n from csquery.structured import phrase\r\n\r\n q = phrase('star', boost=2, field='title')\r\n q() #=> (phrase field=title boost=2 'star')\r\n\r\nprefix\r\n-------\r\n\r\nSyntax: (prefix field=FIELD boost=N 'STRING')\r\n\r\n.. code-block:: python\r\n\r\n from csquery.structured import prefix\r\n\r\n q = prefix('star', boost=2, field='title')\r\n q() #=> (prefix field=title boost=2 'star')\r\n\r\nrange\r\n------\r\n\r\nSyntax: (range field=FIELD boost=N RANGE)\r\n\r\n.. code-block:: python\r\n\r\n from csquery.structured import range_\r\n\r\n q = range_((1990, 2000))\r\n q() #=> (range [1990,2000])\r\n q = range_((None, 2000))\r\n q() #=> (range {,2000])\r\n q = range_((1990,))\r\n q() #=> (range [1990,})\r\n\r\n # with opition\r\n q = range_((1990, 2000), field='date', boost=2)\r\n q() #=> (range field=date boost=2 [1990,2000])\r\n\r\n # another writing\r\n q = range_('[1990,2000]')\r\n q() #=> (range [1990,2000])\r\n\r\n q = range_(('', 2000))\r\n q() #=> (range {,2000])\r\n q = range_('{,2000]')\r\n q() #=> (range {,2000])\r\n\r\n q = range_((1990, None))\r\n q() #=> (range [1990,})\r\n q = range_((1990, ''))\r\n q() #=> (range [1990,})\r\n q = range_('[1990,}')\r\n q() #=> (range [1990,})\r\n\r\nterm\r\n--------\r\n\r\nSyntax: (term field=FIELD boost=N 'STRING'\\|VALUE)\r\n\r\n.. code-block:: python\r\n\r\n from csquery.structured import term\r\n\r\n q = term(2000, field='year', boost=2)\r\n q() #=> (term field=year boost=2 2000)\r\n\r\n q = term('star', field='title', boost=2)\r\n q() #=> (term field=title boost=2 'star')\r\n\r\nComplex query sample\r\n----------------------\r\n\r\n.. code-block:: python\r\n\r\n from csquery.structured import and_, or_, not_, term\r\n\r\n q = and_(\r\n not_('test', field='genres'),\r\n or_(\r\n term('star', field='title', boost=2),\r\n term('star', field='plot')\r\n )\r\n )\r\n q() #=> (and (not field=genres 'test') (or (term field=title boost=2 'star') (term field=plot 'star')))\r\n\r\nUsing with boto\r\n-----------------\r\n\r\nhttp://boto.readthedocs.org/en/latest/ref/cloudsearch2.html\r\n\r\n.. code-block:: python\r\n\r\n from csquery.structured import and_\r\n from boto.cloudsearch2.layer2 import Layer2\r\n\r\n conn = Layer2(\r\n region='ap-northeast-1',\r\n aws_access_key_id=[AWS ACCESSS KEY ID],\r\n aws_secret_access_key=[AWS SECRET KEY],\r\n )\r\n domain = conn.lookup('search_domain_name')\r\n search_service = domain.get_search_service()\r\n\r\n q = and_(title='star', actors='Harrison Ford', year=('', 2000))\r\n result = search_service.search(q=q(), parser='structured')\r\n\r\nPython Support\r\n==============\r\n* Python 2.7, 3,3, 3.4 or later.\r\n\r\nLicense\r\n=======\r\n* Source code of this library Licensed under the MIT License.\r\n\r\nSee the LICENSE.rst file for specific terms.\r\n\r\nAuthors\r\n=======\r\n\r\n* tell-k \r\n\r\nContributors\r\n==============\r\n\r\nThanks.\r\n\r\n* @podhmo\r\n* @furi\r\n\r\nHistory\r\n=======\r\n\r\n0.1.4(Nov 25, 2015)\r\n-----------------------------\r\n\r\n* Fixed unquoted field value. `#4 `_.\r\n\r\n0.1.3(Nov 20, 2015)\r\n---------------------\r\n\r\n* Fixed over escaped expression. `#3 `_.\r\n\r\n0.1.2(Nov 18, 2015)\r\n---------------------\r\n\r\n* Fixed escape bug. `#2 `_.\r\n\r\n0.1.1(Nov 6, 2015)\r\n---------------------\r\n\r\n* Fixed bug. `#1 `_.\r\n\r\n0.1.0(Jun 8, 2015)\r\n---------------------\r\n* First release\r\n\r\n.. |travis| image:: https://travis-ci.org/tell-k/csquery.svg?branch=master\r\n :target: https://travis-ci.org/tell-k/csquery\r\n\r\n.. |coveralls| image:: https://coveralls.io/repos/tell-k/csquery/badge.png\r\n :target: https://coveralls.io/r/tell-k/csquery\r\n :alt: coveralls.io\r\n\r\n.. |requires| image:: https://requires.io/github/tell-k/csquery/requirements.svg?branch=master\r\n :target: https://requires.io/github/tell-k/csquery/requirements/?branch=master\r\n :alt: requirements status\r\n\r\n.. |downloads| image:: https://img.shields.io/pypi/dm/csquery.svg\r\n :target: http://pypi.python.org/pypi/csquery/\r\n :alt: downloads\r\n\r\n.. |version| image:: https://img.shields.io/pypi/v/csquery.svg\r\n :target: http://pypi.python.org/pypi/csquery/\r\n :alt: latest version\r\n\r\n.. |license| image:: https://img.shields.io/pypi/l/csquery.svg\r\n :target: http://pypi.python.org/pypi/csquery/\r\n :alt: license", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tell-k/csquery", "keywords": "aws amazon cloudsearch querybuilder structured", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "csquery", "package_url": "https://pypi.org/project/csquery/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/csquery/", "project_urls": { "Homepage": "https://github.com/tell-k/csquery" }, "release_url": "https://pypi.org/project/csquery/0.1.4/", "requires_dist": [ "six" ], "requires_python": "", "summary": "A simple query builder for Amazon Cloudsearch structured query parser.", "version": "0.1.4" }, "last_serial": 1832447, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "711b2677b4457da8d74b6af2d736a1b5", "sha256": "df764c08dc8026b0ece370550749854fe3f2b99207767a3805e9b21f92fd6480" }, "downloads": -1, "filename": "csquery-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "711b2677b4457da8d74b6af2d736a1b5", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 7551, "upload_time": "2015-06-08T07:48:43", "url": "https://files.pythonhosted.org/packages/0c/5f/3c7220968eede3202faaef1b56ed10843aff4c2f01378d9b4ef926d84f62/csquery-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "587bcf9415c234ce2927b0c50e061ae6", "sha256": "f48ac2838de25ab07a22b0fe750a7ed28a16d236269838151a30486cca233490" }, "downloads": -1, "filename": "csquery-0.1.0.tar.gz", "has_sig": false, "md5_digest": "587bcf9415c234ce2927b0c50e061ae6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7849, "upload_time": "2015-06-08T07:48:37", "url": "https://files.pythonhosted.org/packages/6b/87/924fde3c1d6c532b32fad861dc6311f2e5da0f02f4fb21368cf018eb894d/csquery-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f8bfcdcb9c2941e47d4b8d8615ae782d", "sha256": "3a8090def29dbb97cc6d6dda58a6554f5ae08368b4ff96ea7be6dd2630da6153" }, "downloads": -1, "filename": "csquery-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f8bfcdcb9c2941e47d4b8d8615ae782d", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 9153, "upload_time": "2015-11-06T06:15:56", "url": "https://files.pythonhosted.org/packages/dc/05/5a59e3a3da713b3527bef2988525489d63d0916e945d7fa3e4020ab054d0/csquery-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "60531a140ebf97ed39cb67b115ebee32", "sha256": "05fddec1d610b9f5c3bc05a93085b266958cc26efd20921a7f126a409b170379" }, "downloads": -1, "filename": "csquery-0.1.1.tar.gz", "has_sig": false, "md5_digest": "60531a140ebf97ed39cb67b115ebee32", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8348, "upload_time": "2015-11-06T06:15:50", "url": "https://files.pythonhosted.org/packages/e3/23/43d5bd0a66183c2b4e1809a5c9149db712453fd76b4dc89e52a2602ab9c6/csquery-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "a2a7c636f45b4b04e1717452b0c38f20", "sha256": "f4ea3115c33e6a93dea3c913dd3f50d1fe9bac726acaefe183ade02b3a16b281" }, "downloads": -1, "filename": "csquery-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a2a7c636f45b4b04e1717452b0c38f20", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9283, "upload_time": "2015-11-17T16:07:38", "url": "https://files.pythonhosted.org/packages/13/b1/609b286bf78bfa7c5980026d26a74efd97ed79e1dc42406638697bc3ee46/csquery-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ee9564244984733a203d06b43891a5a6", "sha256": "39ed266e33bc8bc41083f7e029f6f72f2941216c19a0bc151017508e0edf569f" }, "downloads": -1, "filename": "csquery-0.1.2.tar.gz", "has_sig": false, "md5_digest": "ee9564244984733a203d06b43891a5a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8455, "upload_time": "2015-11-17T16:07:49", "url": "https://files.pythonhosted.org/packages/6e/43/16e786e0ef25e73a5b7b981eed6fc6f50a2f15e35b39f6fa947fa9ccb12f/csquery-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "5473f2ab44c70fc0a803e522f8f2101c", "sha256": "27ae7c042c96fcb549266c56e8cd227cccb63dce2585bfcce65807f8125e0e2c" }, "downloads": -1, "filename": "csquery-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5473f2ab44c70fc0a803e522f8f2101c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9350, "upload_time": "2015-11-20T14:57:29", "url": "https://files.pythonhosted.org/packages/b0/6c/faffbd860f51b55048a3b35336f213fd639ad29470b1727aac78e6ac0eb1/csquery-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8479cf9e822d4a7b83b40e8aaa209f60", "sha256": "0023a20ef183a3f655e9cfd7f5b9aaa879ff04a580185edeaac88c803490289e" }, "downloads": -1, "filename": "csquery-0.1.3.tar.gz", "has_sig": false, "md5_digest": "8479cf9e822d4a7b83b40e8aaa209f60", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8620, "upload_time": "2015-11-20T14:57:48", "url": "https://files.pythonhosted.org/packages/6e/00/dc52d981c2fb501fd559e979fab9db567046bd174e8e9ce5053e9dee8b61/csquery-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "3e693813a409c96793e1caa4c2704b73", "sha256": "7f1fc3fb8dc3985fe878182dd0d8c1e95e3ef6971519ec9b026264bf82ce245d" }, "downloads": -1, "filename": "csquery-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3e693813a409c96793e1caa4c2704b73", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9444, "upload_time": "2015-11-25T04:23:24", "url": "https://files.pythonhosted.org/packages/7a/30/f2f1369e822ba6bfab28f807e00ca51f9513bfede095aec50ecc2f090479/csquery-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61f972af6194f4f65d30b411c82cdb36", "sha256": "467420c8d96a7486b34aaa56f30f327c6de09b759b873fc385e4057b5c2d2218" }, "downloads": -1, "filename": "csquery-0.1.4.tar.gz", "has_sig": false, "md5_digest": "61f972af6194f4f65d30b411c82cdb36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8810, "upload_time": "2015-11-25T04:23:32", "url": "https://files.pythonhosted.org/packages/29/be/f881e24c434fab3fdcd9e5725ca3792d9380fc8c3f9741feb3725c1027d0/csquery-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3e693813a409c96793e1caa4c2704b73", "sha256": "7f1fc3fb8dc3985fe878182dd0d8c1e95e3ef6971519ec9b026264bf82ce245d" }, "downloads": -1, "filename": "csquery-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3e693813a409c96793e1caa4c2704b73", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9444, "upload_time": "2015-11-25T04:23:24", "url": "https://files.pythonhosted.org/packages/7a/30/f2f1369e822ba6bfab28f807e00ca51f9513bfede095aec50ecc2f090479/csquery-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61f972af6194f4f65d30b411c82cdb36", "sha256": "467420c8d96a7486b34aaa56f30f327c6de09b759b873fc385e4057b5c2d2218" }, "downloads": -1, "filename": "csquery-0.1.4.tar.gz", "has_sig": false, "md5_digest": "61f972af6194f4f65d30b411c82cdb36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8810, "upload_time": "2015-11-25T04:23:32", "url": "https://files.pythonhosted.org/packages/29/be/f881e24c434fab3fdcd9e5725ca3792d9380fc8c3f9741feb3725c1027d0/csquery-0.1.4.tar.gz" } ] }