{ "info": { "author": "Asad Dhamani", "author_email": "dhamaniasad+code@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Welcome to Flask-WhooshAlchemy!\n===============================\n\n[![Build Status](https://travis-ci.org/dhamaniasad/Flask-WhooshAlchemy.svg?branch=master)](https://travis-ci.org/dhamaniasad/Flask-WhooshAlchemy) [![image](https://circleci.com/gh/dhamaniasad/Flask-WhooshAlchemy/tree/master.svg?style=shield)](https://circleci.com/gh/dhamaniasad/Flask-WhooshAlchemy/tree/master) [![image](https://img.shields.io/pypi/v/Flask-WhooshAlchemy-Redux.svg)](https://pypi.python.org/pypi/Flask-WhooshAlchemy-Redux)\n\nFlask-WhooshAlchemy is a Flask extension that integrates the text-search functionality of [Whoosh](https://bitbucket.org/mchaput/whoosh/wiki/Home) with the ORM of [SQLAlchemy](http://www.sqlalchemy.org/) for use in [Flask](http://flask.pocoo.org/) applications.\n\nSource code and issue tracking at [GitHub](https://github.com/dhamaniasad/Flask-WhooshAlchemy).\n\nView the official docs [here](https://Flask-WhooshAlchemy.readthedocs.org/).\n\nInstall\n-------\n\n pip install flask_whooshalchemy_redux\n\nOr:\n\n git clone https://github.com/dhamaniasad/Flask-WhooshAlchemy.git\n\nQuickstart\n----------\n\nLet's set up the environment and create our model:\n\n```python\nimport flask.ext.whooshalchemy as whooshalchemy\n\n# set the location for the whoosh index\napp.config['WHOOSH_BASE'] = 'path/to/whoosh/base'\n\n\nclass BlogPost(db.Model):\n __tablename__ = 'blogpost'\n __searchable__ = ['title', 'content'] # these fields will be indexed by whoosh\n __analyzer__ = SimpleAnalyzer() # configure analyzer; defaults to\n # StemmingAnalyzer if not specified\n\n id = app.db.Column(app.db.Integer, primary_key=True)\n title = app.db.Column(app.db.Unicode) # Indexed fields are either String,\n content = app.db.Column(app.db.Text) # Unicode, or Text\n created = db.Column(db.DateTime, default=datetime.datetime.utcnow)\n\nwhooshalchemy.whoosh_index(app, BlogPost)\n```\n\nOnly two steps to get started:\n\n1) Set the `WHOOSH_BASE` to the path for the whoosh index. If not set, it will default to a directory called 'whoosh\\_index' in the directory from which the application is run.\n2) Add a `__searchable__` field to the model which specifies the fields (as `str` s) to be indexed .\n\nLet's create a post:\n\n```python\ndb.session.add(\n BlogPost(title='My cool title', content='This is the first post.')\n); db.session.commit()\n```\n\nAfter the session is committed, our new `BlogPost` is indexed. Similarly, if the post is deleted, it will be removed from the Whoosh index.\n\nText Searching\n--------------\n\nTo execute a simple search:\n\n```python\nresults = BlogPost.query.whoosh_search('cool')\n```\n\nThis will return all `BlogPost` instances in which at least one indexed\nfield (i.e., 'title' or 'content') is a text match to the query. Results\nare ranked according to their relevance score, with the best match\nappearing first when iterating. The result of this call is a (subclass\nof) sqlalchemy.orm.query.Query object, so you can chain other SQL\noperations. For example:\n\n```python\ntwo_days_ago = datetime.date.today() - datetime.timedelta(2)\nrecent_matches = BlogPost.query.whoosh_search('first').filter(\n BlogPost.created >= two_days_ago)\n```\n\nOr, in alternative (likely slower) order:\n\n```python\nrecent_matches = BlogPost.query.filter(\n BlogPost.created >= two_days_ago).whoosh_search('first')\n```\n\nWe can limit results:\n\n```python\n# get 2 best results:\nresults = BlogPost.query.whoosh_search('cool', limit=2)\n```\n\nBy default, the search is executed on all of the indexed fields as an OR\nconjunction. For example, if a model has 'title' and 'content' indicated\nas `__searchable__`, a query will be checked against both fields,\nreturning any instance whose title or content are a content match for\nthe query. To specify particular fields to be checked, populate the\n`fields` parameter with the desired fields:\n\n```python\nresults = BlogPost.query.whoosh_search('cool', fields=('title',))\n```\n\nBy default, results will only be returned if they contain all of the\nquery terms (AND). To switch to an OR grouping, set the `or_` parameter\nto `True`:\n\n```python\nresults = BlogPost.query.whoosh_search('cool', or_=True)\n```", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dhamaniasad/Flask-WhooshAlchemy", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "Flask-WhooshAlchemy-Redux", "package_url": "https://pypi.org/project/Flask-WhooshAlchemy-Redux/", "platform": "any", "project_url": "https://pypi.org/project/Flask-WhooshAlchemy-Redux/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/dhamaniasad/Flask-WhooshAlchemy" }, "release_url": "https://pypi.org/project/Flask-WhooshAlchemy-Redux/0.7.1/", "requires_dist": null, "requires_python": null, "summary": "Whoosh extension to Flask/SQLAlchemy", "version": "0.7.1" }, "last_serial": 1855321, "releases": { "0.6.1": [ { "comment_text": "", "digests": { "md5": "5e771056ca333fa4af07736a1ade14cf", "sha256": "2881f36feb28188045ebb4c05ad051c993d8efb460d70202abb35be3ddc27e7e" }, "downloads": -1, "filename": "Flask-WhooshAlchemy-Redux-0.6.1.tar.gz", "has_sig": false, "md5_digest": "5e771056ca333fa4af07736a1ade14cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8993, "upload_time": "2015-06-19T06:41:24", "url": "https://files.pythonhosted.org/packages/71/b9/64c2470f5e10e2b9be47acd6ee254fb46e2c45889bd2c883975753e925e1/Flask-WhooshAlchemy-Redux-0.6.1.tar.gz" } ], "0.6.2": [ { "comment_text": "", "digests": { "md5": "03dea11bcf3b4581ad5dcba81a305478", "sha256": "68fa323b317208f73e56c6f2085a502026cbeb9f103916c9a9bf3210a84181e6" }, "downloads": -1, "filename": "Flask-WhooshAlchemy-Redux-0.6.2.tar.gz", "has_sig": false, "md5_digest": "03dea11bcf3b4581ad5dcba81a305478", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9045, "upload_time": "2015-06-19T07:39:45", "url": "https://files.pythonhosted.org/packages/b8/32/9ba48d750ee4251fe05bf05ba999014b7a1eee29e42800c41b55cf20865d/Flask-WhooshAlchemy-Redux-0.6.2.tar.gz" } ], "0.6.3": [ { "comment_text": "", "digests": { "md5": "c7978da50013188cf0d60c058f1461bb", "sha256": "f5ac8f308f56d568aa3ffa446a2d237557454be4321477a7c58073ad94dafbdd" }, "downloads": -1, "filename": "Flask_WhooshAlchemy_Redux-0.6.3-py2.7.egg", "has_sig": false, "md5_digest": "c7978da50013188cf0d60c058f1461bb", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 10570, "upload_time": "2015-11-09T17:36:47", "url": "https://files.pythonhosted.org/packages/1a/96/e059136a78ecf9e7df646a5883133775c37618b2e2fec804dc57182855d0/Flask_WhooshAlchemy_Redux-0.6.3-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "bb37a143552f3cfb848807556a174744", "sha256": "8ebf4048c802721a018b421b3dfd33ad5b9ec6a2954b3f9850ca4c66ec7b94ae" }, "downloads": -1, "filename": "Flask-WhooshAlchemy-Redux-0.6.3.tar.gz", "has_sig": false, "md5_digest": "bb37a143552f3cfb848807556a174744", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9349, "upload_time": "2015-11-09T17:36:35", "url": "https://files.pythonhosted.org/packages/58/bd/0276bf17bc8c6988bf3f85b8741789c22b5512c9c786eed6e3c1767a8cf8/Flask-WhooshAlchemy-Redux-0.6.3.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "1a73f6f70d476e4c5f9d26eb1acfef0f", "sha256": "fd754158ed3a91c83e4c561c8039549fade67645f54df72f87ac8ef08ea53f0d" }, "downloads": -1, "filename": "Flask_WhooshAlchemy_Redux-0.7-py2.7.egg", "has_sig": false, "md5_digest": "1a73f6f70d476e4c5f9d26eb1acfef0f", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 10678, "upload_time": "2015-11-09T20:54:56", "url": "https://files.pythonhosted.org/packages/37/09/0621ac475dfd810bf3b6efdaa24fe25bef3244ddbf585c12640d8ee7b1bb/Flask_WhooshAlchemy_Redux-0.7-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "ab35a8a42102a0645880038702f1db1e", "sha256": "3efd57dd61654311227ddef5bdec198e022bd760000cb4efcdafccd4cf41674a" }, "downloads": -1, "filename": "Flask-WhooshAlchemy-Redux-0.7.tar.gz", "has_sig": false, "md5_digest": "ab35a8a42102a0645880038702f1db1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9418, "upload_time": "2015-11-09T20:54:46", "url": "https://files.pythonhosted.org/packages/8b/57/0ab24278358b7d6c1ebc41d53fff104715b7b2d707f7f4b3b324e28a152b/Flask-WhooshAlchemy-Redux-0.7.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "5d4f9544e2d49686826551051632e79d", "sha256": "10fe3d132d18409393d244a44614c5bb78403ca497ac396995341e8282926186" }, "downloads": -1, "filename": "Flask-WhooshAlchemy-Redux-0.7.1.tar.gz", "has_sig": false, "md5_digest": "5d4f9544e2d49686826551051632e79d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9467, "upload_time": "2015-12-10T11:52:22", "url": "https://files.pythonhosted.org/packages/33/46/f8183109c5b4be9f96d4c0a382bc296ff9ab6c78d68808e1ef1aa97a9686/Flask-WhooshAlchemy-Redux-0.7.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5d4f9544e2d49686826551051632e79d", "sha256": "10fe3d132d18409393d244a44614c5bb78403ca497ac396995341e8282926186" }, "downloads": -1, "filename": "Flask-WhooshAlchemy-Redux-0.7.1.tar.gz", "has_sig": false, "md5_digest": "5d4f9544e2d49686826551051632e79d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9467, "upload_time": "2015-12-10T11:52:22", "url": "https://files.pythonhosted.org/packages/33/46/f8183109c5b4be9f96d4c0a382bc296ff9ab6c78d68808e1ef1aa97a9686/Flask-WhooshAlchemy-Redux-0.7.1.tar.gz" } ] }