jonaprieto / flask-ponywhoosh Goto Github PK
View Code? Open in Web Editor NEWA Flask full-text search engine
Home Page: https://jonaprieto.github.io/flask-ponywhoosh
License: MIT License
A Flask full-text search engine
Home Page: https://jonaprieto.github.io/flask-ponywhoosh
License: MIT License
what the title says
I tried to use the url in the example.py
before was:
app.config['PONYWHOOSH_URL'] = '/ponywhoosh'
I changed to:
app.config['PONYWHOOSH_URL'] = '/'
but it didn't change internally.
I had to go to pony whoosh and it was by default /ponywhoosh/ . Can we check this?
pip3 install flask-ponywhoosh
completes, then get example.py from
https://github.com/compiteing/flask-ponywhoosh/blob/e11c402df7a7ee0324c0323f17e179d61464e7fb/example.py and attempt to run with Python 3.5.1:
C:\Users\clach04\py\pony_whoosh_flask\p3PonyWooshFlask\lib\site-packages\flask\exthook.py:71: ExtDeprecationWarning: Importing flask.ext.bootstrap is deprecated, use flask_bootstrap instead.
.format(x=modname), ExtDeprecationWarning
C:\Users\clach04\py\pony_whoosh_flask\p3PonyWooshFlask\lib\site-packages\flask\exthook.py:71: ExtDeprecationWarning: Importing flask.ext.script is deprecated, use flask_script instead.
.format(x=modname), ExtDeprecationWarning
Traceback (most recent call last):
File "example.py", line 11, in <module>
from flask.ext.script import Manager, Shell
File "C:\Users\clach04\py\pony_whoosh_flask\p3PonyWooshFlask\lib\site-packages\flask\exthook.py", line 110, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named flask.ext.script
However flask_bootstrap is present in setup.py and requirements.txt and pip log shows it was installed:
Collecting flask-ponywhoosh
Downloading Flask-PonyWhoosh-0.2.tar.gz
Collecting flask (from flask-ponywhoosh)
Downloading Flask-0.11.1-py2.py3-none-any.whl (80kB)
100% |################################| 81kB 1.1MB/s
Collecting ponywhoosh (from flask-ponywhoosh)
Downloading ponywhoosh-1.7.tar.gz
Collecting flask-bootstrap (from flask-ponywhoosh)
Downloading Flask-Bootstrap-3.3.7.0.tar.gz (456kB)
100% |################################| 458kB 431kB/s
Collecting flask-wtf (from flask-ponywhoosh)
Downloading Flask-WTF-0.12.tar.gz (247kB)
100% |################################| 249kB 819kB/s
Collecting itsdangerous>=0.21 (from flask->flask-ponywhoosh)
Downloading itsdangerous-0.24.tar.gz (46kB)
100% |################################| 49kB 1.7MB/s
Collecting Werkzeug>=0.7 (from flask->flask-ponywhoosh)
Using cached Werkzeug-0.11.11-py2.py3-none-any.whl
Collecting Jinja2>=2.4 (from flask->flask-ponywhoosh)
Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
100% |################################| 266kB 1.2MB/s
Collecting click>=2.0 (from flask->flask-ponywhoosh)
Downloading click-6.6.tar.gz (283kB)
100% |################################| 286kB 413kB/s
Collecting pony (from ponywhoosh->flask-ponywhoosh)
Downloading pony-0.6.6.zip (276kB)
100% |################################| 278kB 744kB/s
Collecting whoosh (from ponywhoosh->flask-ponywhoosh)
Downloading Whoosh-2.7.4-py2.py3-none-any.whl (468kB)
100% |################################| 471kB 375kB/s
Collecting dominate (from flask-bootstrap->flask-ponywhoosh)
Downloading dominate-2.2.1.zip (46kB)
100% |################################| 49kB 1.7MB/s
Collecting visitor (from flask-bootstrap->flask-ponywhoosh)
Downloading visitor-0.1.3.tar.gz
Collecting WTForms (from flask-wtf->flask-ponywhoosh)
Downloading WTForms-2.1.zip (553kB)
100% |################################| 557kB 365kB/s
Collecting MarkupSafe (from Jinja2>=2.4->flask->flask-ponywhoosh)
Downloading MarkupSafe-0.23.tar.gz
Installing collected packages: itsdangerous, Werkzeug, MarkupSafe, Jinja2, click, flask, pony, whoosh, ponywhoosh, dominate, visitor, flask-bootstrap, WTForms,
flask-wtf, flask-ponywhoosh
Running setup.py install for itsdangerous
Running setup.py install for MarkupSafe
Running setup.py install for click
Running setup.py install for pony
Running setup.py install for ponywhoosh
Running setup.py install for dominate
Running setup.py install for visitor
Running setup.py install for flask-bootstrap
Running setup.py install for WTForms
Running setup.py install for flask-wtf
Running setup.py install for flask-ponywhoosh
Successfully installed Jinja2-2.8 MarkupSafe-0.23 WTForms-2.1 Werkzeug-0.11.11 click-6.6 dominate-2.2.1 flask-0.11.1 flask-bootstrap-3.3.7.0 flask-ponywhoosh-0.2 flask-wtf-0.12 itsdangerous-0.24 pony-0.6.6 ponywhoosh-1.7 visitor-0.1.3 whoosh-2.7.4
'cant_results' is more than 10 but still 'results' fetches only 10 results from the database. What configuration should I change to increase this number to show more than 10 in the corresponding UI?
After install flask-ponywhoosh in an isolate application, route /search/ not working.
The template ponywhoosh/index.html
doesn't exist.
127.0.0.1 - - [08/Oct/2017 11:35:56] "GET /search HTTP/1.1" 301 -
/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask_ponywhoosh/views.py:51: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
ctx = {'form' : SearchForm()}
/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask_ponywhoosh/views.py:55: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = SearchForm()
127.0.0.1 - - [08/Oct/2017 11:35:56] "GET /search/ HTTP/1.1" 500 -
Traceback (most recent call last):
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask_restful/__init__.py", line 273, in error_router
return original_handler(e)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask_restful/__init__.py", line 273, in error_router
return original_handler(e)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/views.py", line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask_ponywhoosh/views.py", line 110, in dispatch_request
, query=query
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/templating.py", line 133, in render_template
return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/jinja2/environment.py", line 869, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/jinja2/environment.py", line 830, in get_template
return self._load_template(name, self.make_globals(globals))
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/jinja2/environment.py", line 804, in _load_template
template = self.loader.load(self, name, globals)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/jinja2/loaders.py", line 113, in load
source, filename, uptodate = self.get_source(environment, name)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/templating.py", line 57, in get_source
return self._get_source_fast(environment, template)
File "/Users/jonaprieto/agda-pkg-server/venv/lib/python2.7/site-packages/flask/templating.py", line 85, in _get_source_fast
raise TemplateNotFound(template)
TemplateNotFound: ponywhoosh/index.html
There was an error when I use pip install flask-ponywhoosh
to install the extension, the error as follows:
Could not find a version that satisfies the requirement flask-ponywhoosh (from versions: )
No matching distribution found for flask-ponywhoosh
The main keyword would be probably register_model
as the decorator
to specify which fields are intended to be searchable.
I suggest changing this to search_by
or something more meaningful.
What do you think @piperod?
Every single package in the requirement file should have lower and upper bound for the version supported.
example >= 1.0.1 and example <= 2.0.1
The index in the example looks very disorganized. We should put the search view in that index.
To run the default view of the search engine we need to define FlaskBootstrap by default.
I am getting this error in a clean installation:
Collecting flask-ponywhoosh
Downloading flask-ponywhoosh-0.2.1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/_s/9079w4h9665fb3q9r0s6k3b00000gn/T/pip-build-YP69OR/flask-ponywhoosh/setup.py", line 45, in <module>
, read('CHANGELOG.rst')
File "/private/var/folders/_s/9079w4h9665fb3q9r0s6k3b00000gn/T/pip-build-YP69OR/flask-ponywhoosh/setup.py", line 30, in read
, encoding=kwargs.get('encoding', 'utf8')
IOError: [Errno 2] No such file or directory: '/private/var/folders/_s/9079w4h9665fb3q9r0s6k3b00000gn/T/pip-build-YP69OR/flask-ponywhoosh/CHANGELOG.rst'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/_s/9079w4h9665fb3q9r0s6k3b00000gn/T/pip-build-YP69OR/flask-ponywhoosh/
Some FlaskWTF's updates have raised some warning.
...
FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
...
Many parts of the documentation are out-dated.
We need also to enhance examples.
Gifs for recorded sessions (we need new ones)
Consistency in title cases (better titles also)
What else?
Please all this task should be solved in the branch develop.
$ git checkout develop
All this concern to the README file.
Add the specific requirements of the package
Add a clean installation inside a virtual environment. See this
Add the easiest example for this package. ( I installed and now what?)
Add the collaboration section, and contributors.
docs:
Update the screenshots, and reduce the size of it, put in the margin right.
How to do that?
In a clean installation (inside a virtual environment):
$ python example.py
Traceback (most recent call last):
File "example.py", line 10, in <module>
from flask_script import Manager, Shell
ImportError: No module named flask_script
Reviewing the Flask-WhooshAlquemy
, there are interesting issue about popular searchers. gyllstromk/Flask-WhooshAlchemy#41
If we think to include for the next version something like that, it would be nice:
x = Car.pure_whoosh('Aud*')
print x
<Top 1 Results for Or([Prefix('display_name', u'au'), Prefix('description', u'au'), Prefix('name', u'au')]) runtime=0.00333499908447>
x
x.collector x.extend x.has_exact_length x.order x.searcher
x.copy x.facet_names x.has_matched_terms x.q x.top_n
x.docnum x.fields x.highlighter x.query_terms x.upgrade
x.docs x.filter x.is_empty x.runtime x.upgrade_and_extend
x.docset x.formatter x.items x.score
x.estimated_length x.fragmenter x.key_terms x.scored_length
x.estimated_min_length x.groups x.matched_terms x.scorer
Talking into account that it would not be a object like one above but it will be a dictionary item.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.