{ "info": { "author": "UNKNOWN", "author_email": "UNKNOWN", "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-WhooshAlchemyPlus!\n===================================\n\nForked from `gyllstromk/Flask-WhooshAlchemy `_\n\nFlask-WhooshAlchemyPlus is a Flask extension that integrates the text-search functionality of `Whoosh `_ with the ORM of `SQLAlchemy `_ for use in `Flask `_ applications.\n\nSource code and issue tracking at `GitHub `_.\n\n\nInstall\n-------\n\n::\n\n $ pip install flask_whooshalchemyplus\n\nOr:\n\n::\n\n $ git clone https://github.com/Revolution1/Flask-WhooshAlchemyPlus.git\n $ cd Flask-WhooshAlchemyPlus && python setup.py install\n\nQuickstart\n----------\n\nLet's set up the environment and create our model:\n\n::\n\n import flask_whooshalchemyplus\n\n # set the location for the whoosh index\n app.config['WHOOSH_BASE'] = 'path/to/whoosh/base'\n\n\n class 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\n flask_whooshalchemyplus.init_app(app) # initialize\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 .\n3) set ``WHOOSH_DISABLED`` to ``True`` to disable whoosh indexing .\n\nLet's create a post:\n\n::\n\n db.session.add(\n BlogPost(title='My cool title', content='This is the first post.')\n ); db.session.commit()\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\n\nManually Indexing\n-----------------\n\nBy defualt records can be indexed only when the server is running.\nSo if you want to index them manually:\n\n::\n\n from flask_whooshalchemyplus import index_all\n\n index_all(app)\n\n\nText Searching\n--------------\n\nTo execute a simple search:\n\n::\n\n results = BlogPost.query.whoosh_search('cool')\n\nThis will return all ``BlogPost`` instances in which at least one indexed field (i.e., 'title' or 'content') is a text match to the query. Results are ranked according to their relevance score, with the best match appearing first when iterating. The result of this call is a (subclass of) ``sqlalchemy.orm.query.Query`` object, so you can chain other SQL operations. For example::\n\n two_days_ago = datetime.date.today() - datetime.timedelta(2)\n recent_matches = BlogPost.query.whoosh_search('first').filter(\n BlogPost.created >= two_days_ago)\n\nOr, in alternative (likely slower) order::\n\n recent_matches = BlogPost.query.filter(\n BlogPost.created >= two_days_ago).whoosh_search('first')\n\nWe can limit results::\n\n # get 2 best results:\n results = BlogPost.query.whoosh_search('cool', limit=2)\n\nBy default, the search is executed on all of the indexed fields as an OR conjunction. For example, if a model has 'title' and 'content' indicated as ``__searchable__``, a query will be checked against both fields, returning any instance whose title or content are a content match for the query. To specify particular fields to be checked, populate the ``fields`` parameter with the desired fields::\n\n results = BlogPost.query.whoosh_search('cool', fields=('title',))\n\nBy default, results will only be returned if they contain all of the query terms (AND). To switch to an OR grouping, set the ``or_`` parameter to ``True``::\n\n results = BlogPost.query.whoosh_search('cool', or_=True)\n\n\nIf you want ordinary text matching result too::\n\n results = BlogPost.query.whoosh_search('cool', like=True)\n\nThis acts like ``whoosh_search('cool') + SQL LIKE '%cool%'``\n\n\npure_whoosh\n------------------\n\nIf you want the ``whoosh.index.searcher().search()`` result::\n\n results = BlogPost.pure_whoosh(self, query, limit=None, fields=None, or_=False)\n\nWhooshDisabled context manager\n------------------------------\n\nTo disable whoosh indexing temporarily:\n\n::\n\n with WhooshDisabled():\n do sth.\n\n\nCHANGELOG\n---------\n\n- v0.7.5 :\n \n - feature: add WhooshDisabled context manager\n - feature: add whoosh_index_all and init_app method\n - refactory: indexing methods\n - fix: index error: model has no attribute '__searchable__'\n\n- v0.7.4 :\n\n - Feature: add fuzzy-searching using SQL LIKE\n\n- v0.7.3 :\n\n - Fix: Chinese analyzer does not take affect\n\n- v0.7.2 :\n\n - Fix: index_all cannot detect indexable models by itself\n\n- v0.7.1 :\n\n - Feature: Indexing child module class `github issue #43 `_\n - Feature: Add python3 supprot\n - Fix: Obey result sorting if caller explicitly uses order_by() on query `github pull request #32 `_\n - Fix: custom query_class usage `github pull request #35 `_\n - Feature: add ``WHOOSH_DISABLED`` option to disable whooshalchemyplus at runtime", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "Container-WhooshAlchemyPlus", "package_url": "https://pypi.org/project/Container-WhooshAlchemyPlus/", "platform": "any", "project_url": "https://pypi.org/project/Container-WhooshAlchemyPlus/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/Container-WhooshAlchemyPlus/0.7.5.post3/", "requires_dist": null, "requires_python": null, "summary": "Whoosh extension to Flask/SQLAlchemy which used in sina container", "version": "0.7.5.post3" }, "last_serial": 2324945, "releases": { "0.7.5.post3": [ { "comment_text": "", "digests": { "md5": "1ec2c389fbf549233ca89e04b79849f5", "sha256": "a60fc2f7c5115e48bcf0a86b8fa8a620130c37dccdf528b48504b880367c3987" }, "downloads": -1, "filename": "Container_WhooshAlchemyPlus-0.7.5.post3-py2.7.egg", "has_sig": false, "md5_digest": "1ec2c389fbf549233ca89e04b79849f5", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 14356, "upload_time": "2016-09-05T05:33:21", "url": "https://files.pythonhosted.org/packages/8a/b2/337e8739d4bb6d0cc0a54debb46a994b2b6162e5c748e44f6b57c87969ba/Container_WhooshAlchemyPlus-0.7.5.post3-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "a663b567e6b25554817646ba5714befa", "sha256": "423ecf77954076ae7fa46c638c2b9aa8044fb1df68429fa11bc076231f3624ea" }, "downloads": -1, "filename": "Container-WhooshAlchemyPlus-0.7.5.post3.tar.gz", "has_sig": false, "md5_digest": "a663b567e6b25554817646ba5714befa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10813, "upload_time": "2016-09-05T05:33:17", "url": "https://files.pythonhosted.org/packages/d3/fd/fd6b99be36263e8715212c26d9b6a0d1601dbfb3fd5beb6751eb297162b5/Container-WhooshAlchemyPlus-0.7.5.post3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1ec2c389fbf549233ca89e04b79849f5", "sha256": "a60fc2f7c5115e48bcf0a86b8fa8a620130c37dccdf528b48504b880367c3987" }, "downloads": -1, "filename": "Container_WhooshAlchemyPlus-0.7.5.post3-py2.7.egg", "has_sig": false, "md5_digest": "1ec2c389fbf549233ca89e04b79849f5", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 14356, "upload_time": "2016-09-05T05:33:21", "url": "https://files.pythonhosted.org/packages/8a/b2/337e8739d4bb6d0cc0a54debb46a994b2b6162e5c748e44f6b57c87969ba/Container_WhooshAlchemyPlus-0.7.5.post3-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "a663b567e6b25554817646ba5714befa", "sha256": "423ecf77954076ae7fa46c638c2b9aa8044fb1df68429fa11bc076231f3624ea" }, "downloads": -1, "filename": "Container-WhooshAlchemyPlus-0.7.5.post3.tar.gz", "has_sig": false, "md5_digest": "a663b567e6b25554817646ba5714befa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10813, "upload_time": "2016-09-05T05:33:17", "url": "https://files.pythonhosted.org/packages/d3/fd/fd6b99be36263e8715212c26d9b6a0d1601dbfb3fd5beb6751eb297162b5/Container-WhooshAlchemyPlus-0.7.5.post3.tar.gz" } ] }