【问题标题】:Storing Tags in SOLR在 SOLR 中存储标签
【发布时间】:2014-02-24 20:29:11
【问题描述】:

我是 SOLR 的新手,我希望按标签对搜索结果进行排序。 在 SOLR 文档中存储标签的最佳做法是什么?字段类型设置的最佳做法是什么?

这是我当前将标签存储在逗号分隔列表中的方法。搜索的是“脚本”,但此设置似乎无法产生准确的结果:

[0] => Solarium\QueryType\Select\Result\Document Object
    (
        [fields:protected] => Array
            (
                [id] => 4912
                [description] => Neuarmy™ » YYY_NEUARMY_YES02
                [tags] => type,texture,script
                [save_date] => 1345825890
                [score] => 1.4771256
            )

    )

[1] => Solarium\QueryType\Select\Result\Document Object
    (
        [fields:protected] => Array
            (
                [id] => 1223
                [description] => Timbas Type & Logo Dept.
                [tags] => typography,logo,branding,script
                [save_date] => 1342703206
                [score] => 1.4771256
            )

    )

[2] => Solarium\QueryType\Select\Result\Document Object
    (
        [fields:protected] => Array
            (
                [id] => 1323
                [description] => ibg1pE.jpg 300×200 pixels
                [tags] => logo,script,interview magazine
                [save_date] => 1352914647
                [score] => 1.4771256
            )

    )

【问题讨论】:

标签: php search solr


【解决方案1】:

您应该选择string 类型的multiValued 字段。字符串字段存储没有预索引处理的值,multiValued 允许多个值。

然后让 php 为标签传递数组(“typography”、“logo”、“branding”、“script”)。然后 Solr 将识别它们是多个值。

【讨论】:

    【解决方案2】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-06
      • 1970-01-01
      • 2011-08-12
      • 2023-03-07
      • 2013-08-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多