{ "info": { "author": "Matt Luongo", "author_email": "mhluongo@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: POSIX", "Programming Language :: Python", "Topic :: Text Processing :: Indexing" ], "description": "Lucene Query Builder\n====================\n\n:synopsis: A Python DSL for Lucene queries.\n\nEasily create Lucene query strings without having to learn the language itself. The syntax is simple to use and allows creating larger queries from multiple smaller ones. A basic lesson on proper Lucene queries can be found here_.\n\nSupports Python 2.6+.\n\nGetting Started\n---------------\n\n >>> from lucenequerybuilder import Q\n\n\nCreating Queries\n----------------\n\nA basic query can be given by passing in a string into Q's constructor.\n\n >>> q = Q('a')\n \n >>> q = Q('The quick brown fox')\n\nThe query builder will automatically detect whether a term (no whitespace) or a phrase (multiple terms together seaparated by whitespace) and properly bound them with quotation marks.\n\nAll terms and phrases are expected to be unescaped, and will be escaped::\n\n >>> q = Q(r'The *quick* brown (fox)')\n \n >>> str(q)\n \n '\"The \\\\*quick\\\\* brown \\\\(fox\\\\)\"'\n\nRange Queries\n-------------\n\nRanges are also easy to put into a query. There are two types of range queries, inclusive range and exclusive range. These are passed into the query builder with keyword arguments.\n\n >>> q = Q(inrange=(1,5))\n \n >>> q = Q(exrange=['egg','hgg'])\n\nRanges will work with any list-like object of length 2.\n\n\n\nChaining Queries\n----------------\n\nYou can chain queries with `&` (AND), `|` (OR), `& ~` (AND NOT), `+` (MUST), and `-` (MUST NOT). AND, OR, and AND NOT require a query before and after it shows up. MUST and MUST NOT only work on the query directly afterwards. Some examples are below::\n\n >>> q = Q('a') & Q('b')\n \n >>> q = Q('a') & ~Q('b')\n \n >>> q = +Q('a') -Q('b')\n\n\nNested Queries\n--------------\n\nQueries can be nested inside of each other to create new queries. This makes it easy to group queries together. Examples below::\n\n >>> q = Q(Q('a') & Q('b')) & ~Q('c')\n \n >>> q = Q(Q(Q('a') | Q(inrange=[1,2])) +Q('c))\n\n\nFields\n------\n\nFields can be added to queries by putting in a field as your first argument. Fields cannot have any whitespace and cannot be nested inside each other. The following examples are valid queries::\n\n >>> q = Q('name', 'Edward')\n \n >>> q = Q('text', 'Mary had a little lamb')\n \n >>> q = Q('age', inrange=[10, 9001])\n\nThe following examples are invalid queries which will raise an error::\n\n >>> q = Q('name', Q('lastname', 'Purcell'))\n \n >>> q = Q('bad', Q('range', inrange=[10, 9001]))\n\nFuzzy Queries\n-------------\n\nA fuzzy term query can be accomplished using the fuzzy keyword::\n\n >>> q = Q('name', fuzzy=('edd', .2))\n \n >>> str(q)\n\n 'name:(edd~0.200)'\n\nThe first element in the fuzzy tuple is the term, and the second is the similarity ratio- a float, str, or decimal between 0 and 1.\n\nIf you drop the second element, and just provide a str, the string will signify to use Lucene's default ratio - 0.5::\n\n >>> q = Q('name', fuzzy='edd')\n \n >>> str(q)\n\n 'name:(edd~)'\n\nWildcard Queries\n----------------\n\nTo keep wildcard queries from having '?' and '*' from being escaped, simple include the wildcard flag::\n\n >>> str(Q('c?t', wildcard=True))\n\n 'c?t'\n\nwhich will match 'cat' or 'cot'.\n\nBoosting & Wildcard Queries\n---------------------------\n\nThese queries are not yet supported, but will be soon. Feel free to add support yourself and request a pull!\n\n.. _here: http://lucene.apache.org/java/3_2_0/queryparsersyntax.html", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://packages.python.org/lucene-querybuilder", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "lucene-querybuilder", "package_url": "https://pypi.org/project/lucene-querybuilder/", "platform": "posix", "project_url": "https://pypi.org/project/lucene-querybuilder/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://packages.python.org/lucene-querybuilder" }, "release_url": "https://pypi.org/project/lucene-querybuilder/0.2/", "requires_dist": null, "requires_python": null, "summary": "A DSL to build Lucene text queries in Python.", "version": "0.2" }, "last_serial": 838260, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "69cf43a2d28d57aa613f75c3d6feea4d", "sha256": "1c25a89ea4bcbc8bf50fc7b41f211cca3e17383ac1a06fb3fbbb16b7c9d3132d" }, "downloads": -1, "filename": "lucene-querybuilder-0.1.1.tar.gz", "has_sig": false, "md5_digest": "69cf43a2d28d57aa613f75c3d6feea4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5026, "upload_time": "2011-06-25T18:13:50", "url": "https://files.pythonhosted.org/packages/90/19/a1d4bd1d283a5a5708dbb18b94bb44b061605d0450092f853f76613674c5/lucene-querybuilder-0.1.1.tar.gz" }, { "comment_text": "", "digests": { "md5": "4ee1239d81d1d48e4528afe1845fbcaa", "sha256": "df2689180b1876b9a7ac4a5c264ff19be41ccf017035a2ec2e796fab0eb39c07" }, "downloads": -1, "filename": "lucene-querybuilder-0.1.1.zip", "has_sig": false, "md5_digest": "4ee1239d81d1d48e4528afe1845fbcaa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10011, "upload_time": "2011-06-25T18:13:49", "url": "https://files.pythonhosted.org/packages/08/35/b9c76ac099a3e6bbaddce79ac8daa89c7497fee3b0c3e8ca0b2bd6f3cce0/lucene-querybuilder-0.1.1.zip" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "69beb3a765fcf18c10c61016128ced3c", "sha256": "037e97d0209fcb0474b8d429bbcf97a4de061a20fcc814b22a029889db69ae49" }, "downloads": -1, "filename": "lucene-querybuilder-0.1.2.tar.gz", "has_sig": false, "md5_digest": "69beb3a765fcf18c10c61016128ced3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5063, "upload_time": "2011-06-25T23:58:23", "url": "https://files.pythonhosted.org/packages/fa/3a/5091d9de3d1e94b21d2b1555b91352ccbf4922a62229d34b06abdac4ce94/lucene-querybuilder-0.1.2.tar.gz" }, { "comment_text": "", "digests": { "md5": "78a643b9510555ad618144d183c1f49f", "sha256": "edc00aee14771b1b11986bc733f35cd1ea75f8d2fc2f1f0852bdfd1cd10dff8c" }, "downloads": -1, "filename": "lucene-querybuilder-0.1.2.zip", "has_sig": false, "md5_digest": "78a643b9510555ad618144d183c1f49f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10048, "upload_time": "2011-06-25T23:58:22", "url": "https://files.pythonhosted.org/packages/e3/28/55f859e0ef0e609e2675504546b77671bbe797e7f76990c16569c05bdf17/lucene-querybuilder-0.1.2.zip" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "cbb7fe6ddaf9355c3772077d6c294710", "sha256": "9ebc69e64ae10a4667b170d91ab3742f0e29dab869ea9fdfed5fc2cdd0d00ac2" }, "downloads": -1, "filename": "lucene-querybuilder-0.1.3.tar.gz", "has_sig": false, "md5_digest": "cbb7fe6ddaf9355c3772077d6c294710", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5996, "upload_time": "2011-08-10T19:58:58", "url": "https://files.pythonhosted.org/packages/ce/97/180b228e965d0cd2a7c7f72fbcbd7202c74f99e64b59e569c7a15c080908/lucene-querybuilder-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "cf7f6b439263e8b89778c4c6cd835974", "sha256": "64f76a2542f6635baa37edc588d6017ce043b26baa7135e17c19c6cdfd84245e" }, "downloads": -1, "filename": "lucene-querybuilder-0.1.4.tar.gz", "has_sig": false, "md5_digest": "cf7f6b439263e8b89778c4c6cd835974", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5976, "upload_time": "2011-08-11T06:40:01", "url": "https://files.pythonhosted.org/packages/51/51/574ac38cc518663895ca85788ebe9f0747f584540b50d8091c7bb263325e/lucene-querybuilder-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "2571cc535c06cc9c5ee45b97c6809ac9", "sha256": "e3428fe853a55a3f2f7ff537904c3f6309f931b4d1f423acdc28e5e4be2083b2" }, "downloads": -1, "filename": "lucene-querybuilder-0.1.5.tar.gz", "has_sig": false, "md5_digest": "2571cc535c06cc9c5ee45b97c6809ac9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6617, "upload_time": "2011-09-04T04:54:17", "url": "https://files.pythonhosted.org/packages/14/2f/7d208d17b54b1f7290887497129cc4c40bd644c0d6f445e1c8ce6dbe50e2/lucene-querybuilder-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "ab4eb433159c09a3cdf3e2c0d981a233", "sha256": "c580e6239cdb7a5afe90efc489f86a58a6d1f08a27e174327b3cc8fd97313cc6" }, "downloads": -1, "filename": "lucene-querybuilder-0.1.6.tar.gz", "has_sig": false, "md5_digest": "ab4eb433159c09a3cdf3e2c0d981a233", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6818, "upload_time": "2012-07-27T22:53:14", "url": "https://files.pythonhosted.org/packages/8b/2f/bce8f33b6e6e52b3668c558ac3e7c008b6ec9007b564aa997b41027229d3/lucene-querybuilder-0.1.6.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "f4dfd8ae635307527ff0eb58948955c0", "sha256": "c2c3f634983bc6f1e41a7b1172e08896def85489d6c0b881f30a10af02b04a8f" }, "downloads": -1, "filename": "lucene-querybuilder-0.2.tar.gz", "has_sig": false, "md5_digest": "f4dfd8ae635307527ff0eb58948955c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6858, "upload_time": "2013-08-12T14:45:14", "url": "https://files.pythonhosted.org/packages/10/87/4a13ab3c8cdfa6a68ef8cdbebe507ca5ce8021672cef8239c80362c2fe1e/lucene-querybuilder-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f4dfd8ae635307527ff0eb58948955c0", "sha256": "c2c3f634983bc6f1e41a7b1172e08896def85489d6c0b881f30a10af02b04a8f" }, "downloads": -1, "filename": "lucene-querybuilder-0.2.tar.gz", "has_sig": false, "md5_digest": "f4dfd8ae635307527ff0eb58948955c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6858, "upload_time": "2013-08-12T14:45:14", "url": "https://files.pythonhosted.org/packages/10/87/4a13ab3c8cdfa6a68ef8cdbebe507ca5ce8021672cef8239c80362c2fe1e/lucene-querybuilder-0.2.tar.gz" } ] }