使用特殊字符“-”搜索在Apache Solr中不起作用

p1iqtdky  于 2022-11-05  发布在  Solr
关注(0)|答案(1)|浏览(184)

我在Apache Solr中索引了客户数据,包括姓名、地址、联系电话、出生日期等详细信息。
我尝试使用以下查询搜索索引,但无法获得任何结果。

http://locahost:8983/solr/customer/select?q=address:ATA-1234

这里,特殊字符“-”用于搜索联系号码字段。

  • 根据文档(https://solr.apache.org/guide/7_3/the-standard-query-parser.html#escaping-special-characters)对转义反斜杠感到厌倦,但没有结果
http://locahost:8983/solr/customer/select?q=address:ATA\-1234
http://locahost:8983/solr/customer/select?q=address:"ATA\-1234"
http://locahost:8983/solr/customer/select?q=address:"ATA-1234"
  • 已尝试使用关键字令牌化器工厂空白空间令牌化器工厂(https://solr.apache.org/guide/7_2/tokenizers.html#keyword-tokenizer),但没有结果
  • 是否会对通配符和模糊搜索执行文本分析?下面的查询是否有效?
http://locahost:8983/solr/customer/select?q=contact:*01\-1234*

有人能澄清一下上述疑问吗?

7uzetpgm

7uzetpgm1#

下面的查询可以很好地使用正斜杠(/)。

http://localhost:8983/solr/tech_products/select?q=name:ata/-133

示例:输入值:“三星SpinPoint P120 SP2514 N-硬盘驱动器- 250 GB - ATA-133”

使用StandardTokenizer时,值被拆分为如下标记

ST Samsung  SpinPoint P120  SP2514N hard drive  250 GB  ATA 133

使用ClassicTokenizer,值被拆分为如下标记。

ST Samsung  SpinPoint P120  SP2514N hard drive  250 GB  ATA-133

相关问题