python - Python Whoosh 多字段解析器日期和字符串
问题描述
我正在构建一个搜索引擎,并希望同时搜索字符串和日期。在我的索引date
中是我的日期字段,name
是我的字符串字段:
ix = index.open_dir(dirname)
schema = ix.schema
mp = qparser.MultifieldParser(['date', 'name'], schema, group = og, termclass=FuzzyTerm)
# Add the DateParserPlugin to the parser
mp.add_plugin(DateParserPlugin(free=True))
Whoosh 文档中的日期搜索示例包括日期字段作为日期搜索的前缀,例如:
q = qp.parse(u"date:2005062401")
在多字段查询中,如何结合字符串解析日期?字符串字段是否像下面的示例那样与日期分开?
q = qp.parse(u"date:2005062401, name:tom")
我在文档中找不到这个问题的答案,因此我在这里问。
解决方案
推荐阅读
- css - 如果选择了输入单选按钮,则显示 div
- mysql - 更新和选择 MYSQL
- javascript - 单击 youtube 播放按钮后触发事件
- java - 如何为 aerospike 中的地图条目设置 TTL
- php - 出现错误:CodeIgniter 中的 CodeIgniter\Database\BaseResult::getResult
- string - 如何也为 String 提供自定义 str 方法?
- android - 在设计中,Android中的EditText错误“渲染问题”
- php - 在 macOS Catalina 中上传图像时出现以下错误
- java - 在这种情况下,Spring 会创建父 bean
- javascript - 无法在 React JSX 中访问嵌套对象 JSON