def GET(self, name): STORE_DIR_GOOD = "index_good" STORE_DIR_BAD = "index_bad" vm_env.attachCurrentThread() directory_good = SimpleFSDirectory(File(STORE_DIR_GOOD)) searcher_good = IndexSearcher(DirectoryReader.open(directory_good)) directory_bad = SimpleFSDirectory(File(STORE_DIR_BAD)) searcher_bad = IndexSearcher(DirectoryReader.open(directory_bad)) analyzer = StandardAnalyzer(Version.LUCENE_CURRENT) user_data = web.input(name=None) command = yourInput(user_data) if user_data.brand == '': user_data.brand = '1' res = Run_Score(searcher_good, searcher_bad, analyzer, name, user_data.brand) comments = [] for i in range(len(res)): if len(res[i]) == 9: t = res[i][8] else: t = '' for j in range(len(t)): s = t[j] s.encode("utf8") if len(s) >= 50: comments.append(s) return render.comments(comments)
def GET(self, name): STORE_DIR_GOOD = "index_good" STORE_DIR_BAD = "index_bad" vm_env.attachCurrentThread() directory_good = SimpleFSDirectory(File(STORE_DIR_GOOD)) searcher_good = IndexSearcher(DirectoryReader.open(directory_good)) directory_bad = SimpleFSDirectory(File(STORE_DIR_BAD)) searcher_bad = IndexSearcher(DirectoryReader.open(directory_bad)) analyzer = StandardAnalyzer(Version.LUCENE_CURRENT) user_data = web.input(name=None) command = yourInput(user_data.shop) res = Run_GoodRate(searcher_good, searcher_bad, analyzer, command, user_data.brand) res.append(command) return render.SearchResult(res)