Flask-SQLalchemy-Whoosh


NameFlask-SQLalchemy-Whoosh JSON
Version 0.1.5 PyPI version JSON
download
home_page
SummaryA flask extension that adds full text search capabilites to your SQLAlchemy models using the Whoosh search engine
upload_time2023-11-14 16:34:02
maintainer
docs_urlNone
authorNick
requires_python
license
keywords
VCS
bugtrack_url
requirements blinker click colorama Flask Flask-SQLAlchemy greenlet itsdangerous Jinja2 MarkupSafe SQLAlchemy typing_extensions Werkzeug Whoosh
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Flask-SQLAlchemy-Whoosh
A simple and easy to use Flask extension to add full text search to your SQLAlchemy models using the Whoosh search engine.

### Installing
`$ pip install Flask-SQLAlchemy-Whoosh`

### Setup
```python
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from Flask_SQLalchemy_Whoosh.searcher import WhooshSearcher
from Flask_SQLalchemy_Whoosh.mixin import SearchableMixin

app = Flask(__name__)
db = SQLAlchemy(app)
search = WhooshSearcher(app)
# If you want to use the SearchableMixin
SearchableMixin.init_search(search, db)
```

### Documentation
You can find some documentation [here](https://github.com/Momo8289/Flask-SQLAlchemy-Whoosh/wiki/Docs)

### Example
```python
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from Flask_SQLalchemy_Whoosh.searcher import WhooshSearcher
from Flask_SQLalchemy_Whoosh.mixin import SearchableMixin
from whoosh.fields import ID, TEXT, NUMERIC


app = Flask(__name__)
db = SQLAlchemy(app)
search = WhooshSearcher(app)
SearchableMixin.init_search(search, db)


class Product(SearchableMixin, db.Model):
    __tablename__ = "product"
    # __searchable__ is needed to tell the searcher what to index
    # For documentation on the specifics of each field, refer to the Whoosh documentation
    # https://whoosh.readthedocs.io/en/latest/schema.html
    __searchable__ = {
        "id": ID(stored=True, unique=True),
        "name": TEXT(stored=True),
        "desc": TEXT,
        "price": NUMERIC
    }

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String),
    desc = db.Column(db.String),
    price = db.Column(db.Integer)


# If you want to index a table that  already has entries, use the reindex method
# It will index all entries in the table
Product.reindex()

# Use the search method to search a table
results, total = Product.search("name", "nails")
```




            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "Flask-SQLalchemy-Whoosh",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Nick",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/c0/39/0b3048e73970481ac8c7f87d30e69ad8d63aff9c3d1c0a3d5a3ee3bafabe/flask_sqlalchemy_whoosh-0.1.5.tar.gz",
    "platform": null,
    "description": "# Flask-SQLAlchemy-Whoosh\nA simple and easy to use Flask extension to add full text search to your SQLAlchemy models using the Whoosh search engine.\n\n### Installing\n`$ pip install Flask-SQLAlchemy-Whoosh`\n\n### Setup\n```python\nfrom flask import Flask\nfrom flask_sqlalchemy import SQLAlchemy\nfrom Flask_SQLalchemy_Whoosh.searcher import WhooshSearcher\nfrom Flask_SQLalchemy_Whoosh.mixin import SearchableMixin\n\napp = Flask(__name__)\ndb = SQLAlchemy(app)\nsearch = WhooshSearcher(app)\n# If you want to use the SearchableMixin\nSearchableMixin.init_search(search, db)\n```\n\n### Documentation\nYou can find some documentation [here](https://github.com/Momo8289/Flask-SQLAlchemy-Whoosh/wiki/Docs)\n\n### Example\n```python\nfrom flask import Flask\nfrom flask_sqlalchemy import SQLAlchemy\nfrom Flask_SQLalchemy_Whoosh.searcher import WhooshSearcher\nfrom Flask_SQLalchemy_Whoosh.mixin import SearchableMixin\nfrom whoosh.fields import ID, TEXT, NUMERIC\n\n\napp = Flask(__name__)\ndb = SQLAlchemy(app)\nsearch = WhooshSearcher(app)\nSearchableMixin.init_search(search, db)\n\n\nclass Product(SearchableMixin, db.Model):\n    __tablename__ = \"product\"\n    # __searchable__ is needed to tell the searcher what to index\n    # For documentation on the specifics of each field, refer to the Whoosh documentation\n    # https://whoosh.readthedocs.io/en/latest/schema.html\n    __searchable__ = {\n        \"id\": ID(stored=True, unique=True),\n        \"name\": TEXT(stored=True),\n        \"desc\": TEXT,\n        \"price\": NUMERIC\n    }\n\n    id = db.Column(db.Integer, primary_key=True)\n    name = db.Column(db.String),\n    desc = db.Column(db.String),\n    price = db.Column(db.Integer)\n\n\n# If you want to index a table that  already has entries, use the reindex method\n# It will index all entries in the table\nProduct.reindex()\n\n# Use the search method to search a table\nresults, total = Product.search(\"name\", \"nails\")\n```\n\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A flask extension that adds full text search capabilites to your SQLAlchemy models using the Whoosh search engine",
    "version": "0.1.5",
    "project_urls": {
        "Bug Tracker": "https://github.com/Momo8289/Flask-SQLAlchemy-Whoosh/issues",
        "Documentation": "https://github.com/Momo8289/Flask-SQLAlchemy-Whoosh/wiki/Docs",
        "Homepage": "https://github.com/Momo8289/Flask-SQLAlchemy-Whoosh"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2e0e7f9e486cf7bcdbd4930bd716d150cc0276d126607eb7120bca7557159fca",
                "md5": "62548ac7f63e067b349543f1ef6c52fc",
                "sha256": "9814181dd753e7713731d1c931df5de34519afdc35bc4d121ca3f0119c98be2d"
            },
            "downloads": -1,
            "filename": "flask_sqlalchemy_whoosh-0.1.5-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "62548ac7f63e067b349543f1ef6c52fc",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 4741,
            "upload_time": "2023-11-14T16:33:58",
            "upload_time_iso_8601": "2023-11-14T16:33:58.582072Z",
            "url": "https://files.pythonhosted.org/packages/2e/0e/7f9e486cf7bcdbd4930bd716d150cc0276d126607eb7120bca7557159fca/flask_sqlalchemy_whoosh-0.1.5-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c0390b3048e73970481ac8c7f87d30e69ad8d63aff9c3d1c0a3d5a3ee3bafabe",
                "md5": "af314377aa889a605748699057ab64ba",
                "sha256": "283174c20ed6bbfb66276ca65b98ae714992a15d7170da1cc9d2933ed44e25ae"
            },
            "downloads": -1,
            "filename": "flask_sqlalchemy_whoosh-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "af314377aa889a605748699057ab64ba",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4417,
            "upload_time": "2023-11-14T16:34:02",
            "upload_time_iso_8601": "2023-11-14T16:34:02.325250Z",
            "url": "https://files.pythonhosted.org/packages/c0/39/0b3048e73970481ac8c7f87d30e69ad8d63aff9c3d1c0a3d5a3ee3bafabe/flask_sqlalchemy_whoosh-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-14 16:34:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Momo8289",
    "github_project": "Flask-SQLAlchemy-Whoosh",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "blinker",
            "specs": [
                [
                    "==",
                    "1.6.2"
                ]
            ]
        },
        {
            "name": "click",
            "specs": [
                [
                    "==",
                    "8.1.3"
                ]
            ]
        },
        {
            "name": "colorama",
            "specs": [
                [
                    "==",
                    "0.4.6"
                ]
            ]
        },
        {
            "name": "Flask",
            "specs": [
                [
                    "==",
                    "2.3.2"
                ]
            ]
        },
        {
            "name": "Flask-SQLAlchemy",
            "specs": [
                [
                    "==",
                    "3.0.3"
                ]
            ]
        },
        {
            "name": "greenlet",
            "specs": [
                [
                    "==",
                    "2.0.2"
                ]
            ]
        },
        {
            "name": "itsdangerous",
            "specs": [
                [
                    "==",
                    "2.1.2"
                ]
            ]
        },
        {
            "name": "Jinja2",
            "specs": [
                [
                    "==",
                    "3.1.2"
                ]
            ]
        },
        {
            "name": "MarkupSafe",
            "specs": [
                [
                    "==",
                    "2.1.3"
                ]
            ]
        },
        {
            "name": "SQLAlchemy",
            "specs": [
                [
                    "==",
                    "2.0.15"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    "==",
                    "4.6.3"
                ]
            ]
        },
        {
            "name": "Werkzeug",
            "specs": [
                [
                    "==",
                    "3.0.1"
                ]
            ]
        },
        {
            "name": "Whoosh",
            "specs": [
                [
                    "==",
                    "2.7.4"
                ]
            ]
        }
    ],
    "lcname": "flask-sqlalchemy-whoosh"
}
        
Elapsed time: 0.13723s