Hi.
My probleme with search-api and lucene :
I make index and search with a script python test.py.
python manage.py shell < test.py
It's ok, and give me results.
But when I use this.
python manage.py runserver 8080 --verbosity=2
and add the first line in a view script :
from django.contrib.search.backends import LuceneIndexer
When I call a page, the processus runserver crash !!!
No error message in console !
Peharps an install error ?
I use debian etch
I user svn django version.
Database postgres8.1.
I think my PyLucene install is ok (make test is ok).
Detail : http://www.1et0.org/admin/db/pylucene (with some french sorry).
I am not sure my install method search-api is correct.
I just copy the svn checkout
django/branches/search-api/django/contrib/search
in
/usr/lib/python2.4/site-packages/django/contrib/
Idea and advise wellcome.
Thx.
Xavier. Noobs in django (first django application).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGB8G14dg3EDuiPUcRAiaZAJ9hUvECeuuUfsEvJPGVoKhdzP9KUQCeMBnG
Zq4n4ZfoWaQ1uMZI5Hxwm7M=
=1IJg
-----END PGP SIGNATURE-----
The solution is rather simple, use it in its own separte thread. See
for example turbolucene, http://dev.krys.ca/turbolucene/
Thx :)
Norjee a écrit :
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGB8cG4dg3EDuiPUcRArWLAJ4yEo4dbN5Nup9GsQRrvSp5IGnuFACfU/I2
B/fBhs8VyR0l/LjI7mSMz9s=
=uX5t
-----END PGP SIGNATURE-----
Solution found in pylucene-dev :
changed django/utils/autoreload.py
from:
import thread
to:
import PyLucene.PythonThread as thread
Norjee a écrit :
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGB8154dg3EDuiPUcRAjSEAJ9UCCcNK98gwCSsKA5cyTjUIs4axwCfa6Pa
fzPgFykklqUxV8iridyKOqA=
=3eai
-----END PGP SIGNATURE-----
I guess you could even create a decorator for such functions
interfacing with pylucene..
On 26 mrt, 15:41, xav4django <xav4dja...@yahoo.fr> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Solution found in pylucene-dev :
>
> changed django/utils/autoreload.py
> from:
> import thread
> to:
> import PyLucene.PythonThread as thread
>
> Norjee a écrit :
>
> > Pylucene has some threading issues (read incompatibilities with python
> > threads, it must be run from either the main thread, or its own thread
> > version).
>
> > The solution is rather simple, use it in its own separte thread. See
> > for example turbolucene,http://dev.krys.ca/turbolucene/
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
Norjee a écrit :
> I'm afraid your solution only works when using the development server,
> and even then when used in auto_reload mode.
You are in true.
> I think the easiest solution is to simply execute the functions
> interfacing with pylucene in their own thread. something like:
> def search(query):
> - delegate work to new pylucene thread
> - join it with current thread
> - do something with result
>
> I guess you could even create a decorator for such functions
> interfacing with pylucene..
It's didn't work for me. Do you have a succes with this ?
I do some test for pylucene.
My results :
pylucene + django without mod-python : succes here.
http://www.1et0.org/admin/db/pylucene/django-without-mod-python
I test PyLucene.PythonThread.
It's work with thread and django shell, but crash with mod_python.
I test JvAttachCurrentThread
(I make a patch for pylucene for add the wrapper)
http://www.1et0.org/admin/db/pylucene/trypatch/patch.txt
It's work with thread and django shell, but crash with mod_python.
More info about my test here
http://www.1et0.org/admin/db/pylucene/trypatch
my sample test thread are here :
testthread.py : thread simple (error with shell, error with mod_python)
testthread2.py : thread solution. (ok with shell error with mod_python)
testthread3.py : patch JvAttachCurrentThread2 (ok with shell, error with
mod_python)
My question is :
Anyone have a succes for pylucene, django and mod_python ?
Someone did test pylucene with mod_fastcgi ?
Thx, Xavier.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGEiEA4dg3EDuiPUcRAuy2AJ9WOU+08NYSdyLVOPsxXDkBxm34bgCeKs3o
M9g+RUty6mk1fEXGNwArC8o=
=VWja
-----END PGP SIGNATURE-----
this isn't exactly an answer for your question (using lucene with mod-
python).
put you might want to look at Solr ( http://lucene.apache.org/solr/ )
which wraps the lucene search engine in a HTTP server.
the benefits are:
- scalability
- no mucking about with language wrappers like pylucene and threading
issues you are currently having
- easier to access the search collection from other applications.
regards
Ian
--
Ian Holsman
I...@Holsman.net
http://peopleintopoker.com/ -- where the poker people go
Ian Holsman a écrit :
> put you might want to look at Solr ( http://lucene.apache.org/solr/ )
> which wraps the lucene search engine in a HTTP server.
Thx. I will see that.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGEkNE4dg3EDuiPUcRAoXjAJ4u4jf023NVheQ1gwAf7+kNJL2SPQCfQD7G
V9o9nUKUtd2Pj9aWVAB3RRU=
=mR9C
-----END PGP SIGNATURE-----