In Apache Solr's managed-schema.xml, it is an attribute that can be specified for field types and field definitions. The default is multiValued="false", indicating that the field can hold only one value.
Let's explain with a specific example. Let's consider the schema design for product search on an e-commerce site. In product search, each product becomes a single searchable document in the search engine. In addition to fields like product name and price, let's assume there are the following fields in this product document.
- Category field. Each product belongs to one category.
- Tag field. Users can assign their own tags to products.
For example, let's consider the product 'Post-it notes'. This product belongs to the 'Stationery' category. Additionally, users can assign their own tags to this product, such as '#easy_to_use', '#colorful', '#cute', etc.
Thinking in this way, the category field has one value, while the tag field has multiple values, so it would be set as multiValued="true".
<field name="category" type="string" indexed="true" stored="true"/>
<field name="tags" type="string" indexed="true" stored="true" multiValued="true"/>