首页 > 解决方案 > 我不知道如何在 solr 的字段中通过查询找到单词的确切位置?

问题描述

我的问题解决起来很复杂,我在我的 debian 9 虚拟机中安装了 solr,目的是进行插入海量数据测试。具体通过脚本

垃圾箱/帖子

它将所有 pdf 和 doc 文件上传到我在 solr 中的集合中。我的问题是在内容中进行查询时,我的结果是整个内容,而不是告诉我结果在哪里。我想通过查询知道单词或句子到底在哪里。

例如:

"content":["This is my \nfirst test\n This is my \nfirst test\n This is my \nfirst test\n This is my \nfirst test\n This is my \nfirst test \n"], "metadata.X-Parsed-By":["org.apache.tika.parser.DefaultParser", "org.apache.tika.parser.txt.TXTParser"], "metadata.Content-Encoding":["ISO-8859-1"], "metadata.resourceName":["tika_extract.py"], "metadata.Content-Type":["text/x-python; charset=ISO-8859-1"], "id":"4ebba9d3-239c-494d-9a1f-9ec16610530b", "_version_":1630918290423414784},

询问:

{content: "test"}

我目前的结果是:

"content":["This is my \nfirst test\n This is my \nfirst test\n This is my \nfirst test\n This is my \nfirst test\n This is my \nfirst test \n"]

我需要这个结果:

"content": ["这是我的\n第一个测试\n这是我的\n第一个 测试\n这是我的\n第一个测试\n这是我的\n第一个测试\n这是我的\n第一个测试\ n"]

我的主要目标是只知道匹配词在内容或整个句子中的位置,其他替代方案不是问题。

等待我的问题得到最好的解释。

标签: solr

解决方案


推荐阅读