{ "info": { "author": "Nicholas Day", "author_email": "nick@nickendo.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "WhooshAlchemy\n=============\n\nALPHA but actively developed.\n\nSupports the easy text-indexing of SQLAlchemy model fields.\n\nBSD license.\n\nWritten by Stefane Fermigier (http://www.fermigier.com/) based on\nFlask-WhooshAlchemy written by Karl Gyllstromk.\n\n\nQuick start example\n-------------------\n\nImport this library:\n\n>>> from whooshalchemy import IndexService\n\nStandard SQLAlchemy imports:\n\n>>> from sqlalchemy.ext.declarative import declarative_base\n>>> from sqlalchemy.schema import Column\n>>> from sqlalchemy.types import Integer, Text, DateTime\n>>> from sqlalchemy.engine import create_engine\n>>> from sqlalchemy.orm.session import sessionmaker\n\nSetup SQLAlchemy:\n\n>>> engine = create_engine('sqlite:///:memory:')\n>>> Session = sessionmaker(bind=engine)\n>>> session = Session()\n>>> Base = declarative_base()\n\nOur model:\n\n>>> class BlogPost(Base):\n... __tablename__ = 'blogpost'\n... __searchable__ = ['title', 'content'] # these fields will be indexed by whoosh\n...\n... id = Column(Integer, primary_key=True)\n... title = Column(Text)\n... content = Column(Text)\n...\n... def __repr__(self):\n... return '{0}(title={1})'.format(self.__class__.__name__, self.title)\n...\n>>> Base.metadata.create_all(engine)\n\nCreate and init indexing service:\n\n>>> config = {\"WHOOSH_BASE\": \"/tmp/whoosh\"}\n>>> index_service = IndexService(config=config, session=session)\n>>> index_service.register_class(BlogPost)\nFileIndex(FileStorage('/tmp/whoosh/BlogPost'), 'MAIN')\n\nCreate a blog post:\n\n>>> m = BlogPost(title=u'My cool title', content=u'This is the first post.')\n>>> session.add(m); session.commit()\n\nPerform a few searches:\n\n>>> list(BlogPost.search_query(u'cool'))\n[BlogPost(title=My cool title)]\n>>> list(BlogPost.search_query(u'first'))\n[BlogPost(title=My cool title)]\n\nNote: the response is a ``BaseQuery`` object, so you can append other SQL operations:\n\n>>> list(BlogPost.search_query(u'first').filter(BlogPost.id >= 0))\n[BlogPost(title=My cool title)]\n\nUsing with Flask\n----------------\n\nSetup you Flask app, create the ``db`` object (``db = SQLAlchemy(app)``), import your models.\n\nSet ``WHOOSH_BASE`` to your Whoosh index directory in your Flask , then create the index service\nand register your models:\n\n>>> index_service = IndexService(config=app.config)\n>>> index_service.register_class(MyFirstModel)\n>>> index_service.register_class(MySecondModel)\n\nEtc.", "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/nicholasday/WhooshAlchemy", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "WhooshAlchemy3", "package_url": "https://pypi.org/project/WhooshAlchemy3/", "platform": "any", "project_url": "https://pypi.org/project/WhooshAlchemy3/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/nicholasday/WhooshAlchemy" }, "release_url": "https://pypi.org/project/WhooshAlchemy3/0.1.5/", "requires_dist": null, "requires_python": null, "summary": "Whoosh extension to SQLAlchemy", "version": "0.1.5" }, "last_serial": 1291466, "releases": { "0.1.5": [ { "comment_text": "", "digests": { "md5": "476ef11056402ea9fda14068658929fa", "sha256": "652a248c8f0fbf0b4cc5960cb879d8f936427f5933cc9af94918e1c5cf85f86e" }, "downloads": -1, "filename": "WhooshAlchemy3-0.1.5.tar.gz", "has_sig": false, "md5_digest": "476ef11056402ea9fda14068658929fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5314, "upload_time": "2014-11-02T02:16:51", "url": "https://files.pythonhosted.org/packages/33/26/e4e6b7b81491245eb632079b2c4502d1a7c4034ef179d09a6614a0a077b5/WhooshAlchemy3-0.1.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "476ef11056402ea9fda14068658929fa", "sha256": "652a248c8f0fbf0b4cc5960cb879d8f936427f5933cc9af94918e1c5cf85f86e" }, "downloads": -1, "filename": "WhooshAlchemy3-0.1.5.tar.gz", "has_sig": false, "md5_digest": "476ef11056402ea9fda14068658929fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5314, "upload_time": "2014-11-02T02:16:51", "url": "https://files.pythonhosted.org/packages/33/26/e4e6b7b81491245eb632079b2c4502d1a7c4034ef179d09a6614a0a077b5/WhooshAlchemy3-0.1.5.tar.gz" } ] }