What is the use of “multiValued” field type in Solr?

后端 未结 3 1255
盖世英雄少女心
盖世英雄少女心 2020-11-27 15:43

I\'m new to Apache Solr. Even after reading the documentation part, I\'m finding it difficult to clearly understand the functionality and use of the multiValued

3条回答
  •  情歌与酒
    2020-11-27 16:19

    A multivalued field is useful when there are more than one value present for the field. An easy example would be tags, there can be multiple tags that need to be indexed. so if we have tags field as multivalued then solr response will return a list instead of a string value. One point to note is that you need to submit multiple lines for each value of the tags like:

    tag1
    tag2
    ...
    tagn
    

    Once you have all the values index you can search or filter results by any value, e,g. you can find all documents with tag1 using query like

    q=tags:tag1
    

    or use the tags to filter out results like

    q=query&fq=tags:tag1
    

提交回复
热议问题