doujing2017 2014-01-31 23:34
浏览 65
已采纳

在SOLR中存储标签

I am new to SOLR and am looking to order search results by tags. What is the best practice for storing tags in SOLR documents and what is the best practice for field type settings?

Here is my current method where the tags are stored in a comma delimited list. The search was for "script" but this setup doesn't seem to produce accurate results:

[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
            )

    )
  • 写回答

2条回答 默认 最新

  • doucezhu3570 2014-02-03 12:09
    关注

    You should choose a multiValued field of string type. The string field stores values without the pre-indexing mangulation and multiValued allows multiple values.

    Then make php pass array( "typography", "logo", "branding", "script") for tags. Then Solr will recognise they are multiple values.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?
  • ¥15 关于#vue.js#的问题:修改用户信息功能图片无法回显,数据库中只存了一张图片(相关搜索:字符串)
  • ¥15 texstudio的问题,