{ "info": { "author": "Revolution1", "author_email": "crj93106@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-WhooshAlchemyPlus!\r\n===================================\r\n\r\nForked from `gyllstromk/Flask-WhooshAlchemy `_\r\n\r\nFlask-WhooshAlchemyPlus is a Flask extension that integrates the text-search functionality of `Whoosh `_ with the ORM of `SQLAlchemy `_ for use in `Flask `_ applications.\r\n\r\nSource code and issue tracking at `GitHub `_.\r\n\r\n\r\nInstall\r\n-------\r\n\r\n::\r\n\r\n $ pip install flask_whooshalchemyplus\r\n\r\nOr:\r\n\r\n::\r\n\r\n $ git clone https://github.com/Revolution1/Flask-WhooshAlchemyPlus.git\r\n $ cd Flask-WhooshAlchemyPlus && python setup.py install\r\n\r\nQuickstart\r\n----------\r\n\r\nLet's set up the environment and create our model:\r\n\r\n::\r\n\r\n import flask_whooshalchemyplus\r\n\r\n # set the location for the whoosh index\r\n app.config['WHOOSH_BASE'] = 'path/to/whoosh/base'\r\n\r\n\r\n class BlogPost(db.Model):\r\n __tablename__ = 'blogpost'\r\n __searchable__ = ['title', 'content'] # these fields will be indexed by whoosh\r\n __analyzer__ = SimpleAnalyzer() # configure analyzer; defaults to\r\n # StemmingAnalyzer if not specified\r\n\r\n id = app.db.Column(app.db.Integer, primary_key=True)\r\n title = app.db.Column(app.db.Unicode) # Indexed fields are either String,\r\n content = app.db.Column(app.db.Text) # Unicode, or Text\r\n created = db.Column(db.DateTime, default=datetime.datetime.utcnow)\r\n\r\n flask_whooshalchemyplus.init_app(app) # initialize\r\n\r\nOnly two steps to get started:\r\n\r\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.\r\n2) Add a ``__searchable__`` field to the model which specifies the fields (as ``str`` s) to be indexed .\r\n3) set ``WHOOSH_DISABLED`` to ``True`` to disable whoosh indexing .\r\n\r\nLet's create a post:\r\n\r\n::\r\n\r\n db.session.add(\r\n BlogPost(title='My cool title', content='This is the first post.')\r\n ); db.session.commit()\r\n\r\nAfter the session is committed, our new ``BlogPost`` is indexed. Similarly, if the post is deleted, it will be removed from the Whoosh index.\r\n\r\n\r\nManually Indexing\r\n-----------------\r\n\r\nBy defualt records can be indexed only when the server is running.\r\nSo if you want to index them manually:\r\n\r\n::\r\n\r\n from flask_whooshalchemyplus import index_all\r\n\r\n index_all(app)\r\n\r\n\r\nText Searching\r\n--------------\r\n\r\nTo execute a simple search:\r\n\r\n::\r\n\r\n results = BlogPost.query.whoosh_search('cool')\r\n\r\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::\r\n\r\n two_days_ago = datetime.date.today() - datetime.timedelta(2)\r\n recent_matches = BlogPost.query.whoosh_search('first').filter(\r\n BlogPost.created >= two_days_ago)\r\n\r\nOr, in alternative (likely slower) order::\r\n\r\n recent_matches = BlogPost.query.filter(\r\n BlogPost.created >= two_days_ago).whoosh_search('first')\r\n\r\nWe can limit results::\r\n\r\n # get 2 best results:\r\n results = BlogPost.query.whoosh_search('cool', limit=2)\r\n\r\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::\r\n\r\n results = BlogPost.query.whoosh_search('cool', fields=('title',))\r\n\r\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``::\r\n\r\n results = BlogPost.query.whoosh_search('cool', or_=True)\r\n\r\n\r\nIf you want ordinary text matching result too::\r\n\r\n results = BlogPost.query.whoosh_search('cool', like=True)\r\n\r\nThis acts like ``whoosh_search('cool') + SQL LIKE '%cool%'``\r\n\r\n\r\npure_whoosh\r\n------------------\r\n\r\nIf you want the ``whoosh.index.searcher().search()`` result::\r\n\r\n results = BlogPost.pure_whoosh(self, query, limit=None, fields=None, or_=False)\r\n\r\nWhooshDisabled context manager\r\n------------------------------\r\n\r\nTo disable whoosh indexing temporarily:\r\n\r\n::\r\n\r\n with WhooshDisabled():\r\n do sth.\r\n\r\n\r\nCHANGELOG\r\n---------\r\n\r\n- v0.7.5 :\r\n\r\n - feature: add WhooshDisabled context manager\r\n - feature: add whoosh_index_all and init_app method\r\n - refactory: indexing methods\r\n - fix: index error: model has no attribute '__searchable__'\r\n\r\n- v0.7.4 :\r\n\r\n - Feature: add fuzzy-searching using SQL LIKE\r\n\r\n- v0.7.3 :\r\n\r\n - Fix: Chinese analyzer does not take affect\r\n\r\n- v0.7.2 :\r\n\r\n - Fix: index_all cannot detect indexable models by itself\r\n\r\n- v0.7.1 :\r\n\r\n - Feature: Indexing child module class `github issue #43 `_\r\n - Feature: Add python3 supprot\r\n - Fix: Obey result sorting if caller explicitly uses order_by() on query `github pull request #32 `_\r\n - Fix: custom query_class usage `github pull request #35 `_\r\n - Feature: add ``WHOOSH_DISABLED`` option to disable whooshalchemyplus at runtime", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/revolution1/Flask-WhooshAlchemyPlus", "keywords": "", "license": "BSD", "maintainer": "Revolution1", "maintainer_email": "crj93106@gmail.com", "name": "Flask-WhooshAlchemyPlus", "package_url": "https://pypi.org/project/Flask-WhooshAlchemyPlus/", "platform": "any", "project_url": "https://pypi.org/project/Flask-WhooshAlchemyPlus/", "project_urls": { "Homepage": "https://github.com/revolution1/Flask-WhooshAlchemyPlus" }, "release_url": "https://pypi.org/project/Flask-WhooshAlchemyPlus/0.7.5/", "requires_dist": null, "requires_python": null, "summary": "Whoosh extension to Flask/SQLAlchemy", "version": "0.7.5" }, "last_serial": 2235490, "releases": { "0.7.1": [ { "comment_text": "", "digests": { "md5": "0521a5b12d1327d2364c1cd7cb52a335", "sha256": "2aa8f32a8423ae0642b627b559f20ea02fbc6012adbd0d601bc110d01fd8ad9e" }, "downloads": -1, "filename": "Flask_WhooshAlchemyPlus-0.7.1-py2.7.egg", "has_sig": false, "md5_digest": "0521a5b12d1327d2364c1cd7cb52a335", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 11400, "upload_time": "2016-01-22T20:57:17", "url": "https://files.pythonhosted.org/packages/97/94/8035cfb5611b8d990c2cb4f3665c2a9112201ad5ccdd8822837128f54ad2/Flask_WhooshAlchemyPlus-0.7.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "8d79d290ac649eead25df2317f3b7492", "sha256": "994275363797c53ae104d4b8e1d810fea64c727d921a1ffbff5c82baaa9b77b2" }, "downloads": -1, "filename": "Flask-WhooshAlchemyPlus-0.7.1.tar.gz", "has_sig": false, "md5_digest": "8d79d290ac649eead25df2317f3b7492", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 9909, "upload_time": "2016-01-22T20:57:01", "url": "https://files.pythonhosted.org/packages/4b/6f/bcf813b64ff473bb742481e2d126db6964d94b2cde850a27185a28280fb8/Flask-WhooshAlchemyPlus-0.7.1.tar.gz" } ], "0.7.2": [], "0.7.3": [ { "comment_text": "", "digests": { "md5": "418e253dde2c1a4831b900a74fe0631e", "sha256": "cd7261a882677cc54a09e2f7d3d3eb65b830ab2dd886c80147ab05e803d203fe" }, "downloads": -1, "filename": "Flask_WhooshAlchemyPlus-0.7.3-py2.7.egg", "has_sig": false, "md5_digest": "418e253dde2c1a4831b900a74fe0631e", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 11563, "upload_time": "2016-01-27T18:50:16", "url": "https://files.pythonhosted.org/packages/6a/1b/a7dbffe7bb5bc6a191bbfd3fe48bc308a81dcd68e86e4e087f863481c719/Flask_WhooshAlchemyPlus-0.7.3-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "cb6ff317c202b43e356ee4dfc8c2102d", "sha256": "121f74447dc116171aaa6959b4fa39d95ed784426c05d96b21bc4b2db19b5873" }, "downloads": -1, "filename": "Flask-WhooshAlchemyPlus-0.7.3.tar.gz", "has_sig": false, "md5_digest": "cb6ff317c202b43e356ee4dfc8c2102d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9972, "upload_time": "2016-01-27T18:50:00", "url": "https://files.pythonhosted.org/packages/df/ed/4fcd7bb4cfe3089c31025e1c2e1c02db624e611312bb28f4e6ba1241e4cf/Flask-WhooshAlchemyPlus-0.7.3.tar.gz" } ], "0.7.4": [ { "comment_text": "", "digests": { "md5": "6e738fa63e835e3cc5ab5f28fb8d1fa3", "sha256": "9093b399396d6a006203e49d5051d12aadd9fed23561762ce48a9bf1af7b8a14" }, "downloads": -1, "filename": "Flask_WhooshAlchemyPlus-0.7.4-py2.7.egg", "has_sig": false, "md5_digest": "6e738fa63e835e3cc5ab5f28fb8d1fa3", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 12606, "upload_time": "2016-01-30T16:22:48", "url": "https://files.pythonhosted.org/packages/1c/a3/0a06a985caca5f5d65702a331c45b35d465c5d8ec081c2d2f02f4ddc998f/Flask_WhooshAlchemyPlus-0.7.4-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "fa4f11b908c9e023d83c7ff7046b77cf", "sha256": "378f1434e1856447544cf8c7c112f9f3b7dcfad171b8500ef674c7240ad2d33e" }, "downloads": -1, "filename": "Flask-WhooshAlchemyPlus-0.7.4.tar.gz", "has_sig": false, "md5_digest": "fa4f11b908c9e023d83c7ff7046b77cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10800, "upload_time": "2016-01-30T16:22:34", "url": "https://files.pythonhosted.org/packages/c6/ba/c9f4bc2708a3121c14398642f07c6831c0b229196daca8fe1224ca57e984/Flask-WhooshAlchemyPlus-0.7.4.tar.gz" } ], "0.7.5": [ { "comment_text": "", "digests": { "md5": "61b16599f87f2f25af86d6ff624b9c61", "sha256": "e6429253c4a768e635459ec87d2a7ce5b4e4b8045c8210edc83632ba02468b31" }, "downloads": -1, "filename": "Flask-WhooshAlchemyPlus_V0.7.5.tar.gz", "has_sig": false, "md5_digest": "61b16599f87f2f25af86d6ff624b9c61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10834, "upload_time": "2016-07-21T10:24:34", "url": "https://files.pythonhosted.org/packages/65/92/54bb912ab591990cd1cd8ea6b3b5f5a372f4f25498a41e0ac489c8887770/Flask-WhooshAlchemyPlus_V0.7.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "61b16599f87f2f25af86d6ff624b9c61", "sha256": "e6429253c4a768e635459ec87d2a7ce5b4e4b8045c8210edc83632ba02468b31" }, "downloads": -1, "filename": "Flask-WhooshAlchemyPlus_V0.7.5.tar.gz", "has_sig": false, "md5_digest": "61b16599f87f2f25af86d6ff624b9c61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10834, "upload_time": "2016-07-21T10:24:34", "url": "https://files.pythonhosted.org/packages/65/92/54bb912ab591990cd1cd8ea6b3b5f5a372f4f25498a41e0ac489c8887770/Flask-WhooshAlchemyPlus_V0.7.5.tar.gz" } ] }