{ "info": { "author": "Anthony Aylward", "author_email": "aaylward@eng.ucsd.edu", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Flask-FTSCursor\nAn extension to facilitate using [FTSCursor](https://github.com/anthony-aylward/ftscursor) with Flask\n\n## Installation\n`pip3 install flask-ftscursor`\n\n## Mission Statement\n\nThis package was inspired by Miguel Grinberg's\n[Flask Mega-Tutorial](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world),\nspecifically [Chapter 16: Full-Text Search](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-full-text-search).\nEven more specifically, it was this sentence:\n>Using the searching capabilities of one of the relational databases could also be a good choice, but given the fact that SQLAlchemy does not support this functionality, I would have to handle the searching with raw SQL statements, or else find a package that provides high-level access to text searches while being able to coexist with SQLAlchemy.\n\nFlask-FTSCursor is such a package. It provides high-level access to SQLite3\nfull-text searches while being able to coexist harmoniously with SQLAlchemy.\n\n## Tutorial\n\nThis will be a very minimal demonstration of the `FTS` object. For an example of\nan app that uses Flask-FTSCursor, see [ucsd-bisb-unofficial](https://github.com/anthony-aylward/ucsd-bisb-unofficial/blob/master/ucsd_bisb_unofficial/models.py).\n\nFirst import the things we will need\n```python\nimport sqlite3\nfrom flask import Flask\nfrom flask_ftscursor import FTS\n```\nCreate a `FTS` object\n```python\nfts = FTS()\n```\nDefine an application factory function\n```python\ndef create_app():\n app = Flask(__name__)\n app.config['FTS_DATABASE'] = 'fts.db'\n app.config['FTS_SOURCE_DATABASE'] = 'app.db'\n fts.init_app(app)\n return app\n```\nCreate the app\n```python\napp = create_app()\n```\nPut some data in the source database\n```python\nconn = sqlite3.connect(app.config['FTS_SOURCE_DATABASE'])\nc = conn.cursor()\nc.executescript('''\n CREATE TABLE my_table(id INTEGER, body TEXT);\n INSERT INTO my_table(id, body) VALUES\n (1, 'this is a test'),\n (2, 'a second test');\n '''\n)\nconn.commit()\n```\nTry a search (this will fail, because nothing has been indexed yet)\n```python\nwith app.app_context()\n app.fts.search(table='my_table', query='this test', page=1, per_page=2)\n```\nIndex some rows from the source database (adding them to the FTS database)\n```python\nwith app.app_context()\n app.fts.index(table='my_table', id=1, searchable=('body',))\n app.fts.index(table='my_table', id=2, searchable=('body',))\n```\nPerform a full-text search\n```python\nwith app.app_context()\n app.fts.search(table='my_table', query='this test', page=1, per_page=2)\n```\n```python\n{'hits': {'total': 1, 'hits': ({'_id': 1},)}}\n```\nTry a different query\n```python\nwith app.app_context()\n app.fts.search(table='my_table', query='second', page=1, per_page=2)\n```\n```python\n{'hits': {'total': 1, 'hits': ({'_id': 2},)}}\n```\nDrop the FTS table, removing its contents from the FTS database\n```python\nwith app.app_context()\n app.fts.drop(table='my_table')\n```\n\n## Configuration\n\nFlask-FTSCursor relies on two items in the app's configuration: `FTS_DATABASE`\nand `FTS_SOURCE_DATABASE`.\nThe value of `FTS_SOURCE_DATABASE` should be the file path of the app's main\nSQLite3 database, or whichever database contains the entries that will be\nindexed. The value of `FTS_DATABSE` should be the file path where the database\ncontaining the FTS tables will be kept.\n\n## Abstraction\n\nFlask-FTSCursor provides functions named `add_to_index()`,\n`remove_from_index()`, and `query_index()` which can be used in place of the\nsimilarly named functions given in Miguel Grinberg's Flask Mega-Tutorial,\n[Chapter 16: Full-Text Search](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-full-text-search),\nunder the section titled \"A Full-Text Search Abstraction.\" For an example of\nan app that uses these functions, see [ucsd-bisb-unofficial](https://github.com/anthony-aylward/ucsd-bisb-unofficial/blob/master/ucsd_bisb_unofficial/models.py).\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/anthony-aylward/flask-ftscursor", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "Flask-FTSCursor", "package_url": "https://pypi.org/project/Flask-FTSCursor/", "platform": "any", "project_url": "https://pypi.org/project/Flask-FTSCursor/", "project_urls": { "Homepage": "https://github.com/anthony-aylward/flask-ftscursor" }, "release_url": "https://pypi.org/project/Flask-FTSCursor/0.2.3/", "requires_dist": [ "Flask", "ftscursor" ], "requires_python": "", "summary": "An extension to facilitate using FTSCursor with flask", "version": "0.2.3" }, "last_serial": 5265353, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d328ce196a68ae5a8b2b713bb8e44db1", "sha256": "898555560143f4a6aba7a6db6cbf0ac41c8f9716839fec5b185bafbae30d0568" }, "downloads": -1, "filename": "Flask_FTSCursor-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d328ce196a68ae5a8b2b713bb8e44db1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3475, "upload_time": "2019-01-02T23:10:28", "url": "https://files.pythonhosted.org/packages/86/2b/fd9cbeca0db4d3aa328d9202bc94c21af6b72fa9ee17b9e389eb7c2165e1/Flask_FTSCursor-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8653862e0eb4febaf3a5c8a75b507946", "sha256": "64e9c25bda67ce723849f186c165ffbb51f8f5ef747f17016c0c33cae5b09127" }, "downloads": -1, "filename": "Flask-FTSCursor-0.0.1.tar.gz", "has_sig": false, "md5_digest": "8653862e0eb4febaf3a5c8a75b507946", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2133, "upload_time": "2019-01-02T23:10:30", "url": "https://files.pythonhosted.org/packages/05/94/4f12a8efa36dd5a1badb301b5268d0458d4fdc1c4fba4d55ec42bf4740f1/Flask-FTSCursor-0.0.1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "f96d91d37be681be6236014f50bb1a12", "sha256": "55b41d5c4b68d29cb0b5e98fe3f29803f7e7776fea28b71f43969722d3f8ee7a" }, "downloads": -1, "filename": "Flask_FTSCursor-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f96d91d37be681be6236014f50bb1a12", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3434, "upload_time": "2019-01-03T03:51:06", "url": "https://files.pythonhosted.org/packages/a5/79/df5a61f92285877043f776329d68635f33f0f7ceabc998ff6dfb09300296/Flask_FTSCursor-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "691701d250f9e8878f38e8d48327ea8b", "sha256": "a38b78397df3c80f63ead6b2a523ee91b7e94d4fb706fad4b676ac1c669d5d96" }, "downloads": -1, "filename": "Flask-FTSCursor-0.1.0.tar.gz", "has_sig": false, "md5_digest": "691701d250f9e8878f38e8d48327ea8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2098, "upload_time": "2019-01-03T03:51:08", "url": "https://files.pythonhosted.org/packages/2b/e8/1956103eba0d4592f86eb8950370d768e47c2e6135ae7c7ee74711ac59bf/Flask-FTSCursor-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "6a1052dc84bcc341b32427d67275150a", "sha256": "427cd16405dc2141985f613e4568d215819c464652ec64f2552c7ef681c34ff2" }, "downloads": -1, "filename": "Flask_FTSCursor-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6a1052dc84bcc341b32427d67275150a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3464, "upload_time": "2019-01-03T04:33:13", "url": "https://files.pythonhosted.org/packages/89/6a/57ae95117a19bcace9e31c788e75307d06c231d27e72332d95fbf4790450/Flask_FTSCursor-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c6132f4e74f492891eb54a364bfd2ee5", "sha256": "57ff3897b455f54be5ec79690c7b702a09b7808738d64f28275c80f9a011aa13" }, "downloads": -1, "filename": "Flask-FTSCursor-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c6132f4e74f492891eb54a364bfd2ee5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2129, "upload_time": "2019-01-03T04:33:17", "url": "https://files.pythonhosted.org/packages/54/01/5a31805a3df04b87cc7629678e9da105741258ba52f6cd9f905a365d5ef1/Flask-FTSCursor-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "6948a8cd32ba8da0a3d2cb615a1ec982", "sha256": "7d63d647c859ace777988bc4a11883adf64fba5ca9d660480d6878c99051d1bc" }, "downloads": -1, "filename": "Flask_FTSCursor-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "6948a8cd32ba8da0a3d2cb615a1ec982", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3453, "upload_time": "2019-01-03T04:37:51", "url": "https://files.pythonhosted.org/packages/f0/67/8437ea4fe1b48d4d4805120f2962812d719f57a0f42bd28dc08b1d80c61a/Flask_FTSCursor-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "febdc5ded9d9383a460f44e52a3cd67f", "sha256": "f86fe6544363724a2d6c6d5417923139637bc39403f794df119d9952cebbea96" }, "downloads": -1, "filename": "Flask-FTSCursor-0.1.2.tar.gz", "has_sig": false, "md5_digest": "febdc5ded9d9383a460f44e52a3cd67f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2117, "upload_time": "2019-01-03T04:37:54", "url": "https://files.pythonhosted.org/packages/ed/45/6773213a9603851eb9c4871247d3ded4c128ff7c1a2bf222344d690bb8f1/Flask-FTSCursor-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "a649542308579b2835a6d48086182578", "sha256": "03fd11048b508849f17c4f861ac8f6b5f8f98386f83cfa9ee6e7e499a06a6e96" }, "downloads": -1, "filename": "Flask_FTSCursor-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "a649542308579b2835a6d48086182578", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4576, "upload_time": "2019-01-03T05:43:41", "url": "https://files.pythonhosted.org/packages/ec/5a/7eae65d66866b7716ac3ca1c7f16d50ab1eb68045f4e79493d0aa7bfd6dc/Flask_FTSCursor-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5ad3bb0bf98326966a467f4b93b1f76", "sha256": "05282b1ef96c55636ef3c130a8992bb7d7c2c0c71bc63cc7e12790f9ac70c1f6" }, "downloads": -1, "filename": "Flask-FTSCursor-0.1.3.tar.gz", "has_sig": false, "md5_digest": "e5ad3bb0bf98326966a467f4b93b1f76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3205, "upload_time": "2019-01-03T05:43:45", "url": "https://files.pythonhosted.org/packages/2b/7c/1645300194a879c4e584ed1820102adc44dc70ea104a49b9e6a926826e12/Flask-FTSCursor-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "5a990c58335d9245625a9a0d679c6a99", "sha256": "f79b3eaa8aeed3c4295fb309ad6737b7a49edc94f1c1d97aa7b74bdaaab2094b" }, "downloads": -1, "filename": "Flask_FTSCursor-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "5a990c58335d9245625a9a0d679c6a99", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4581, "upload_time": "2019-01-03T05:45:46", "url": "https://files.pythonhosted.org/packages/ec/56/7e262b002d49efe0572c27ee25d4b5f77c9434004d2349ee9ef226f4ec63/Flask_FTSCursor-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e780832b0e858a8b2ffd7d497c1f7af0", "sha256": "109890a30f5d0925c73bf9dcd177d4b5a5b603a3041c64c09a2758bc55907567" }, "downloads": -1, "filename": "Flask-FTSCursor-0.1.4.tar.gz", "has_sig": false, "md5_digest": "e780832b0e858a8b2ffd7d497c1f7af0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3203, "upload_time": "2019-01-03T05:45:48", "url": "https://files.pythonhosted.org/packages/f7/38/d30ab942484fc55417decf9d4cca096ac8c1058fb6d88bb578af2b30c809/Flask-FTSCursor-0.1.4.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "3b8c1f17eba2bac57c80caf72b8f7615", "sha256": "c1d959c755e2aadd4b9fb030bef9345489a0261b56d6dfb7bf685557594e6cf8" }, "downloads": -1, "filename": "Flask_FTSCursor-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3b8c1f17eba2bac57c80caf72b8f7615", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5336, "upload_time": "2019-01-03T22:33:57", "url": "https://files.pythonhosted.org/packages/4d/fd/28dc408edf31aceca48ee7f1371e32097a3092d17f0f9ff20cefeef0ee9c/Flask_FTSCursor-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "805df3e52a4eb510f0c61a5eb2494af2", "sha256": "ca11d53c7b596f5320f14294f3d4d49be870c12af2a4fe31d618ebb1d373e3e4" }, "downloads": -1, "filename": "Flask-FTSCursor-0.2.0.tar.gz", "has_sig": false, "md5_digest": "805df3e52a4eb510f0c61a5eb2494af2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4110, "upload_time": "2019-01-03T22:33:58", "url": "https://files.pythonhosted.org/packages/3e/8d/72ed4d758f80787cf879d4f0a2953426585bbe12e2895dc52b57d48901c8/Flask-FTSCursor-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "467c34063f7cd158457586e104e7b0e6", "sha256": "94b3ee58d424d7a91156f028f3d11c8ef937e32c7b6eaef193e05ebab7588dee" }, "downloads": -1, "filename": "Flask_FTSCursor-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "467c34063f7cd158457586e104e7b0e6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5589, "upload_time": "2019-01-04T01:06:47", "url": "https://files.pythonhosted.org/packages/fc/42/c6bb7a95437c82940d8453895f01a9aff258302bb3f1931211d6e9ba5cb6/Flask_FTSCursor-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cf78ea626f60d574cc38be77a3ef35e1", "sha256": "f783a699673bbc44db1e5a7a907e924775ea0e5d9f5309e92d2b872e7f1c9da1" }, "downloads": -1, "filename": "Flask-FTSCursor-0.2.1.tar.gz", "has_sig": false, "md5_digest": "cf78ea626f60d574cc38be77a3ef35e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4443, "upload_time": "2019-01-04T01:06:50", "url": "https://files.pythonhosted.org/packages/72/e1/fd6daeedd9bc87c2f455dbaa1123f06b76b8cd073231c454a0a11db3c7a4/Flask-FTSCursor-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "eaa063598c58630876737da845821370", "sha256": "c8d3040046f9e8366527082532fa7275688f7437fd120d11b120ac0c21825204" }, "downloads": -1, "filename": "Flask_FTSCursor-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "eaa063598c58630876737da845821370", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5593, "upload_time": "2019-05-14T00:01:44", "url": "https://files.pythonhosted.org/packages/93/39/60a6af8dcad552cd487210f1fb60f9102df615e76e62ebd7d3a6a40d60d0/Flask_FTSCursor-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "218d75c8b2cff744049aeb7aa07e247e", "sha256": "4e6d49ae445f75a1683727514992e6782454bfcde6a19d0dea731c7d2caec09f" }, "downloads": -1, "filename": "Flask-FTSCursor-0.2.2.tar.gz", "has_sig": false, "md5_digest": "218d75c8b2cff744049aeb7aa07e247e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4436, "upload_time": "2019-05-14T00:01:47", "url": "https://files.pythonhosted.org/packages/3e/90/0573c541a58601bcd0d0cbe16579acb64bd675ce2c44a79abf5eaff71ed0/Flask-FTSCursor-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "3c9d2d1b3fa20b9c2b2f207481f22fb7", "sha256": "c323a713189ab04aea05d42613420b2435137a259ded0dad8959bc1c206a2daf" }, "downloads": -1, "filename": "Flask_FTSCursor-0.2.3-py3-none-any.whl", "has_sig": false, "md5_digest": "3c9d2d1b3fa20b9c2b2f207481f22fb7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5605, "upload_time": "2019-05-14T03:28:56", "url": "https://files.pythonhosted.org/packages/4d/83/f88196ca88d0a3c246f7a34bd05d966fe3fec4a8b0f9a5a6920ea609a874/Flask_FTSCursor-0.2.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6a74b29ec1c764e0ef9488f321240aab", "sha256": "9c59a2a1517829612fa33a98f2e170cfab13cb07c9ba67033c53a9aeb25b2664" }, "downloads": -1, "filename": "Flask-FTSCursor-0.2.3.tar.gz", "has_sig": false, "md5_digest": "6a74b29ec1c764e0ef9488f321240aab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4440, "upload_time": "2019-05-14T03:28:58", "url": "https://files.pythonhosted.org/packages/ad/bd/6ea76f9f111c11f96f84bd0116966980c58b2a62849204f58527df86287b/Flask-FTSCursor-0.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3c9d2d1b3fa20b9c2b2f207481f22fb7", "sha256": "c323a713189ab04aea05d42613420b2435137a259ded0dad8959bc1c206a2daf" }, "downloads": -1, "filename": "Flask_FTSCursor-0.2.3-py3-none-any.whl", "has_sig": false, "md5_digest": "3c9d2d1b3fa20b9c2b2f207481f22fb7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5605, "upload_time": "2019-05-14T03:28:56", "url": "https://files.pythonhosted.org/packages/4d/83/f88196ca88d0a3c246f7a34bd05d966fe3fec4a8b0f9a5a6920ea609a874/Flask_FTSCursor-0.2.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6a74b29ec1c764e0ef9488f321240aab", "sha256": "9c59a2a1517829612fa33a98f2e170cfab13cb07c9ba67033c53a9aeb25b2664" }, "downloads": -1, "filename": "Flask-FTSCursor-0.2.3.tar.gz", "has_sig": false, "md5_digest": "6a74b29ec1c764e0ef9488f321240aab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4440, "upload_time": "2019-05-14T03:28:58", "url": "https://files.pythonhosted.org/packages/ad/bd/6ea76f9f111c11f96f84bd0116966980c58b2a62849204f58527df86287b/Flask-FTSCursor-0.2.3.tar.gz" } ] }