【问题标题】:Get tokens from Index Analyzer and copy to string field从索引分析器获取标记并复制到字符串字段
【发布时间】:2022-09-23 05:12:07
【问题描述】:

这个想法是我有一个带有停用词和小写过滤器的索引分析器的 name_s (solr.TextField) 字段。我想获取索引分析器的输出并将其作为单个字符串复制到字符串字段 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

    标签: solr solr4


    【解决方案1】:

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

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

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

    然后,我可以通过使用如下查询按此字段分面来输出存储在 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]}
    

    您可以在其中看到被索引的各个标记:此记录中此字段的“国内”、“人”、“中继”和“正确”。

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

    【讨论】:

      猜你喜欢
      • 2019-05-24
      • 1970-01-01
      • 1970-01-01
      • 2019-07-22
      • 1970-01-01
      • 1970-01-01
      • 2012-06-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多