solr - 在 Solr 中对字段进行精确搜索
问题描述
我想完全匹配我收藏中的一个字段(域)。现在,如果我搜索“DIU”,它会给我带来“DIU”和“DIU/DRRU”,我只需要“DIU”。当我搜索“DIU/DRRU”时,我只需要“DIU/DRRU”。我怎样才能做到这一点?我正在使用 Solr 7.4
我的架构设置是 -
"name":"domain",
"type":"text_general",
"multiValued":false,
"indexed":true,
"stored":true},
{
"name":"text_general",
"class":"solr.TextField",
"positionIncrementGap":"100",
"multiValued":true,
"indexAnalyzer":{
"tokenizer":{
"class":"solr.StandardTokenizerFactory"},
"filters":[{
"class":"solr.StopFilterFactory",
"words":"stopwords.txt",
"ignoreCase":"true"},
{
"class":"solr.LowerCaseFilterFactory"}]},
"queryAnalyzer":{
"tokenizer":{
"class":"solr.StandardTokenizerFactory"},
"filters":[{
"class":"solr.StopFilterFactory",
"words":"stopwords.txt",
"ignoreCase":"true"},
{
"class":"solr.SynonymGraphFilterFactory",
"expand":"true",
"ignoreCase":"true",
"synonyms":"synonyms.txt"},
{
"class":"solr.LowerCaseFilterFactory"}]}},
解决方案
使用字符串字段而不是text_general
基于字段 -text_general
字段(附加了 StandardTokenizer)将在/
. 只有当string
字段与存储的值完全匹配时,该字段才会给出匹配。
推荐阅读
- python - Using numerical values in plotly for creating Gantt-Charts
- firebase-analytics - 缺少 Firebase app_update 事件
- hyperledger-fabric - 如何在作曲家网络上取消部署网络
- r - 如何在使用 ggplot2 制作条形图时添加辅助轴
- javascript - Markers are not properly aligned with path in d3 with leaflet
- ios - 在不同的视图控制器上使用 UIView (Singleton)
- aix - 如何使用“clrsh”命令
- amazon-web-services - 为什么与 Classic Load Balancer 一起使用的现有 API 不能与 Application Load Balancer 一起使用?
- kubernetes - rke etcd 快照有很多错误
- android - 从Android中选择文件后如何修复“没有这样的文件或目录”?