繁体   English   中英

从索引分析器获取标记并复制到字符串字段

[英]Get tokens from Index Analyzer and copy to string field

这个想法是我有一个带有停用词和小写过滤器的索引分析器的 name_s (solr.TextField) 字段。 我想获取索引分析器的 output 并作为单个字符串复制到字符串字段 name_x。 这可能吗?

例子

Input for name_s: The red brown fox was actually black.
_____________________________________________
Index Analyzed for name_s:
red
brown
fox
black

_____________________________________________
Now input inside of name_x: red brown fox black

我不认为有一种方法可以准确地完成您正在尝试做的事情(将单个令牌从一个字段保存到另一个字段),但是如果您只想检查特定字段的处理方式,您可以作弊并使用方面获取此信息。

例如,假设我有一个文本字段,其中包含关于 id 为“00000004”的文档的以下信息:

"id":"00000004",
"title_txt_en":"Personal rights and the domestic relations /

然后我可以 output 存储在title_txt_en中的单个令牌,通过使用这样的查询按此字段进行分面:

# q=id:00000004
# facet.field=title_txt_en
# f.title_txt_en.facet.mincount=1
curl http://localhost:8983/solr/your-core/select?f.title_txt_en.facet.mincount=1&facet.field=title_txt_en&facet=on&q=id%3A00000004

响应将包括以下内容:

"facet_counts":{
    "facet_queries":{},
    "facet_fields":{
      "title_txt_en":[
        "domest",1,
        "person",1,
        "relat",1,
        "right",1]}

您可以在其中看到被索引的各个标记:此记录中此字段的“domest”、“person”、“relat”和“right”。

正如我所说,这不是您要寻找的确切答案,但希望它有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM