summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryvesf <yvesf-git@xapek.org>2010-11-20 02:12:50 +0100
committeryvesf <yvesf-git@xapek.org>2010-11-20 02:12:50 +0100
commitbec8150c93a640ac4b6d1cebc86bd721dfdd6b59 (patch)
treecc7e02b211afa6ba7ba11432e00124dc617ce760
parent966a17b12c9deab35ef0a804d9fa1faea9c8042d (diff)
downloadbooksearch-bec8150c93a640ac4b6d1cebc86bd721dfdd6b59.tar.gz
booksearch-bec8150c93a640ac4b6d1cebc86bd721dfdd6b59.zip
update INSTALL help; rename index->indexer; prettify web.py
-rw-r--r--INSTALL33
-rw-r--r--LOG7
-rw-r--r--indexer.py (renamed from index.py)0
-rw-r--r--web.py8
4 files changed, 37 insertions, 11 deletions
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..39d4774
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,33 @@
+
+Create a virtualenv
+ virtualenv create booksearch_env
+ cd booksearch_env
+ # activate this virtualenv
+ . ./bin/activate
+
+Install dependencies
+ easy_install pip
+ pip install whoosh
+ pip install pypdf
+ pip install flask
+
+( Clone )
+ git clone http://xapek.org/~yvesf/repos/booksearch.git
+ cd booksearch
+
+Create index
+ python indexer.py ~/my_books
+
+Test index
+ python query.py
+ query> test
+ Term('content', 'test')
+ Match in /home/XXXXX6-4.pdf
+ Match in /home/XXXXX6-4.pdf
+ 2 results
+ query>
+
+Run Webapp
+ python web.py
+ * Running on http://0.0.0.0:5000/
+ * Restarting with reloader...
diff --git a/LOG b/LOG
deleted file mode 100644
index e850077..0000000
--- a/LOG
+++ /dev/null
@@ -1,7 +0,0 @@
-virtualenv create booksearch_env
-cd booksearch_env
-. ./bin/activate
-easy_install pip
-pip install whoosh
-pip install pypdf
-
diff --git a/index.py b/indexer.py
index 5a982a9..5a982a9 100644
--- a/index.py
+++ b/indexer.py
diff --git a/web.py b/web.py
index b747010..babc9dd 100644
--- a/web.py
+++ b/web.py
@@ -1,16 +1,16 @@
#!/usr/bin/python2.6
# coding: utf-8
+from StringIO import StringIO
from whoosh.index import open_dir
from whoosh.qparser import QueryParser
import whoosh.fields as fields
import whoosh.analysis as analysis
-from whoosh import highlight
+import whoosh.highlight as highlight
import flask
-from flask import Flask
import pyPdf
-from StringIO import StringIO
import werkzeug
-app = Flask("booksearch")
+
+app = flask.Flask("booksearch")
index = open_dir(u"index", mapped=False)
searcher = index.searcher()