What is the use of a multiValued field in Solr?

I am new to Apache Solr. Even after reading part of the documentation, itโ€™s hard for me to understand the functionality and use of the multiValued field type multiValued .

What inside Solr does / processes / processes the field marked as multiValued?

What is the difference in indexing in Solr between a field with multiple values โ€‹โ€‹and those that are not?

Can someone explain with a good example?

Doc says:

ambiguous = true | Lying

True, if this field can contain several values โ€‹โ€‹in the document, that is, if it can appear several times in the document

+66
indexing full-text-search solr multivalue
Apr 27 2018-11-11T00:
source share
3 answers

A multi-valued field is useful when there is more than one value for a field. Tags can be an easy example; there may be several tags that need to be indexed. therefore, if I have a tag field as multi-valued, solr will return a list instead of a string value. It should be noted that you need to send multiple lines for each tag value, for example:

 <field name = "tags"> tag1 </tags>
 <field name = "tags"> tag2 </tags>
 ...
 <field name = "tags"> tagn </tags>

as soon as you have all the indexes of values โ€‹โ€‹that you can search or filter results by any value, e, g. you can find all documents with tag1 using a query like

 q=tags:tag1 

or use tags to filter results, for example

 q=query&fq=tags:tag1 
+66
Apr 27 2018-11-11T00:
source share

multiValued, defined in the schema, whether a field is allowed to have more than one value.

For example:
if I have a fieldType identifier, which is the identifier multiValued = false, indexing the document this way:

 doc { id : [ 1, 2] ... } 

will cause the exception to be selected in the indexing stream and the document will not be indexed (checking the scheme will fail).

On the other hand, if I have several values โ€‹โ€‹for a field, I would like to set multiValued = true to guarantee correct indexing, for example:

 doc { id : 1 keywords: [ hello, world ] ... } 

In this case, you define โ€œkeywordsโ€ as a field with multiple values.

+14
Apr 27 2018-11-11T00:
source share

I use several value fields only with copy fields, so think so, say that all fields will be unique, unless it is a copy field, for example, I have the following fields:

 <field name="id" type="string" indexed="true" stored="true"/> <field name="name" type="string" indexed="true" stored="true"/> <field name="subject" type="string" indexed="true" stored="true"/> <field name="location" type="string" indexed="true" stored="true"/> 

I want to request only one field and maybe look for all 4 fields above, then we need to use copyfield. first create a new โ€œallโ€ field call and then copy everything to โ€œallโ€

 <field name="all" type="text" indexed="true" stored="true" multiValued="true"/> <copyField source="*" dest="all"/> 

Now the field "everything" should be ambiguous.

+11
Nov 15 '11 at 10:59
source share



All Articles