本文整理汇总了Python中searcher.Searcher.find_by_full_text方法的典型用法代码示例。如果您正苦于以下问题:Python Searcher.find_by_full_text方法的具体用法?Python Searcher.find_by_full_text怎么用?Python Searcher.find_by_full_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类searcher.Searcher
的用法示例。
在下文中一共展示了Searcher.find_by_full_text方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: search
# 需要导入模块: from searcher import Searcher [as 别名]
# 或者: from searcher.Searcher import find_by_full_text [as 别名]
def search():
global index
query = request.args.get('q')
doc_set = request.args.get('d')
doc_set_names = DocSet(index_directory).get_doc_set_names()
if query:
if doc_set != 'all':
actual_query = u"text:%s doc_set:%s" % (
query, doc_set)
else:
actual_query = query
searcher = Searcher(index)
results = searcher.find_by_full_text(actual_query)
if results:
message = None
else:
message = 'No documents found.'
return render_template("index.html",
results = results,
message = message,
query = query,
selected_doc_set = doc_set,
doc_set_names = doc_set_names)
else:
return render_template("index.html",
doc_set_names = doc_set_names)
示例2: test_documents_found_by_full_text
# 需要导入模块: from searcher import Searcher [as 别名]
# 或者: from searcher.Searcher import find_by_full_text [as 别名]
def test_documents_found_by_full_text():
idx = Index.create('./test_index')
indexer = DirectoryIndexer(idx)
indexer.index_directory('./tests/sample_files')
searcher = Searcher(idx)
assert 2 == len(searcher.find_by_full_text(u'Funny'))