Skip to content
Snippets Groups Projects
Commit 24173a72 authored by felixwelter's avatar felixwelter
Browse files

Rename SearchIndex to BasicSearchIndex

parent 516db59d
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ from whoosh.fields import TEXT, Schema, ID, NUMERIC ...@@ -6,7 +6,7 @@ from whoosh.fields import TEXT, Schema, ID, NUMERIC
from whoosh.qparser import QueryParser, OrGroup from whoosh.qparser import QueryParser, OrGroup
class SearchIndex: class BasicSearchIndex:
def __init__(self, index_dir="index"): def __init__(self, index_dir="index"):
self.schema = Schema(path=ID(stored=True), page=NUMERIC(stored=True), content=TEXT(stored=True)) self.schema = Schema(path=ID(stored=True), page=NUMERIC(stored=True), content=TEXT(stored=True))
try: try:
...@@ -32,7 +32,7 @@ class SearchIndex: ...@@ -32,7 +32,7 @@ class SearchIndex:
if __name__ == "__main__": if __name__ == "__main__":
os.makedirs("index_test") os.makedirs("index_test")
index = SearchIndex("index_test") index = BasicSearchIndex("index_test")
index.add(path=u"/world", page=1, content=u"this is a test about the world") index.add(path=u"/world", page=1, content=u"this is a test about the world")
index.add(path=u"/fire", page=2, content=u"i could not imagine the heat or the regression") index.add(path=u"/fire", page=2, content=u"i could not imagine the heat or the regression")
index.add(path=u"/dream", page=3, content=u"dreaming is special not only to humans but all animals") index.add(path=u"/dream", page=3, content=u"dreaming is special not only to humans but all animals")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment