doujing2017
doujing2017
2014-01-31 23:34

在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 doucezhu3570 7年前

    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.

    点赞 评论 复制链接分享
  • doushen4719 doushen4719 7年前

    Also refer to the following link for better understanding. https://cwiki.apache.org/confluence/display/solr/Documents,+Fields,+and+Schema+Design

    点赞 评论 复制链接分享

为你推荐