Here is a summary of common use cases, and the attributes the fields or field types should have to support the case. An entry of true or false in the table indicates that the option must be set to the given value for the use case to function correctly. If no entry is provided, the setting of that attribute has no impact on the case.
Use Case | indexed | stored | multiValued | omitNorms | termVectors | termPositions | docValues |
---|---|---|---|---|---|---|---|
search within field |
true |
||||||
retrieve contents |
true8 |
true8 |
|||||
use as unique key |
true |
false |
|||||
sort on field |
true7 |
false9 |
true 1 |
true7 |
|||
highlighting |
true4 |
true |
true2 |
true 3 |
|||
faceting 5 |
true7 |
true7 |
|||||
add multiple values, maintaining order |
true |
||||||
field length affects doc score |
false |
||||||
MoreLikeThis 5 |
true 6 |
Notes:
-
A tokenizer must be defined for the field, but it doesn’t need to be indexed.
-
Described in Understanding Analyzers, Tokenizers, and Filters.
-
Term vectors are not mandatory here. If not true, then a stored field is analyzed. So term vectors are recommended, but only required if
stored=false
. -
For most field types, either
indexed
ordocValues
must be true, but both are not required. DocValues can be more efficient in many cases. For[Int/Long/Float/Double/Date]PointFields
,docValues=true
is required. -
Stored content will be used by default, but docValues can alternatively be used. See DocValues.
-
Multi-valued sorting may be performed on docValues-enabled fields using the two-argument
field()
function, e.g.,field(myfield,min)
; see the field() function in Function Queries.
We welcome feedback on Solr documentation. However, we cannot provide application support via comments. If you need help, please send a message to the Solr User mailing list.