以下哪些数据库是全文检索数据库
2015-09-03
展开全部
#一个完整的演示
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from whoosh.index import create_in
from whoosh.fields import *
from whoosh.analysis import RegexAnalyzer
analyzer = RegexAnalyzer(ur”([\u4e00-\u9fa5])|(\w+(\.?\w+)*)”)
schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT(stored=True, analyzer=analyzer))
ix = create_in(“indexdir”, schema)
writer = ix.writer()
writer.add_document(title=u”First document”, path=u”/a”,
content=u”This is the first document we’ve added!”)
writer.add_document(title=u”Second document”, path=u”/b”,
content=u”The second one 你 中文测试中文 is even more interesting!”)
writer.commit()
searcher = ix.searcher()
results = searcher.find(“content”, u”first”)
print results[0]
results = searcher.find(“content”, u”你”)
print results[0]
results = searcher.find(“content”, u”测试”)
print results[0]
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from whoosh.index import create_in
from whoosh.fields import *
from whoosh.analysis import RegexAnalyzer
analyzer = RegexAnalyzer(ur”([\u4e00-\u9fa5])|(\w+(\.?\w+)*)”)
schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT(stored=True, analyzer=analyzer))
ix = create_in(“indexdir”, schema)
writer = ix.writer()
writer.add_document(title=u”First document”, path=u”/a”,
content=u”This is the first document we’ve added!”)
writer.add_document(title=u”Second document”, path=u”/b”,
content=u”The second one 你 中文测试中文 is even more interesting!”)
writer.commit()
searcher = ix.searcher()
results = searcher.find(“content”, u”first”)
print results[0]
results = searcher.find(“content”, u”你”)
print results[0]
results = searcher.find(“content”, u”测试”)
print results[0]
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
今至电子科技有限公司
2024-08-23 广告
2024-08-23 广告
数据库备份是确保数据安全与业务连续性的关键环节。我们上海今至电子科技有限公司高度重视数据保护,定期执行全面的数据库备份策略。这包括使用先进工具和技术,对关键业务数据进行自动化备份,并存储在安全可靠的外部存储介质或云端。通过定期验证备份的完整...
点击进入详情页
本回答由今至电子科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |