From: Marcin Koziej Date: Wed, 12 Oct 2011 07:49:12 +0000 (+0200) Subject: search commit while struggling with pylucene X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/2a92080b0d771caea89575f66c5545897397f9a7?ds=sidebyside;hp=--cc search commit while struggling with pylucene --- 2a92080b0d771caea89575f66c5545897397f9a7 diff --git a/apps/search/__init__.py b/apps/search/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/apps/search/__init__.py @@ -0,0 +1 @@ + diff --git a/apps/search/index.py b/apps/search/index.py new file mode 100644 index 000000000..8f7722a77 --- /dev/null +++ b/apps/search/index.py @@ -0,0 +1,12 @@ + +from django.conf import settings +from lucene import SimpleFSDirectory, IndexWriter +import os + + +class BookSearch(object): + def __init__(self): + if not os.exists(settings.SEARCH_INDEX): + os.mkdir(settings.SEARCH_INDEX) + self.store = IndexWriter(store, ) +