add some comments

This commit is contained in:
Sun Junyi 2013-07-01 11:20:56 +08:00
parent efc784312c
commit dbec3ad9df

View File

@ -1,7 +1,7 @@
# -*- coding: UTF-8 -*-
import sys
sys.path.append("../")
from whoosh.index import create_in
from whoosh.index import create_in,open_dir
from whoosh.fields import *
from whoosh.qparser import QueryParser
@ -10,7 +10,8 @@ from jieba.analyse import ChineseAnalyzer
analyzer = ChineseAnalyzer()
schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT(stored=True, analyzer=analyzer))
ix = create_in("tmp", schema)
ix = create_in("tmp", schema) # for create new index
#ix = open_dir("tmp") # for read only
writer = ix.writer()
writer.add_document(