Solr index vs stored

That is correct. Typically you will want your field to be either indexed or stored or both. If you set both to false, that field will not be available in your Solr docs (either for searching or for displaying). See Alexandre's answer for the special cases when you will want to set both to false.

As stated here : indexed=true makes a field searchable (and sortable and facetable). For eg, if you have a field named test1 with indexed=true, then you can search it like q=test1:foo, where foo is the value you are searching for. If indexed=false for field test1 then that query will return no results, even if you have a document in Solr with test1's value being foo.

stored=true means you can retrieve the field when you search. If you want to explicitly retrieve the value of a field in your query, you will use the fl param in your query like fl=test1 (Default is fl=* meaning retrieve all stored fields). Only if stored=true for test1, the value will be returned. Else it will not be returned.


The main point of having both set to false is to explicitly skip that particular field.

For example, if you have a storing/indexing dynamicField mapping and you want to ignore one particular name that would otherwise fall under dynamicField's pattern.

Alternatively you could use dynamicField to ignore a whole set of fields with same prefix/suffix that comes from a 3rd party. For example, Tika will send you a whole bunch of metadata fields which you may just want to ignore. See this defined in Solr's example schema.xml and used in solrconfig.xml

In the later versions of Solr, you could also use IgnoreFieldUpdateProcessorFactory (see full list for others) instead, which will get rid of those fields even earlier in the indexing process.


Quoting from this response in the Solr's mail thread:

"indexed" and "stored" are independent, orthogonal attributes - you can use any of the four combinations of true and false. "indexed" is used for search or query, the "lookup" portion of processing a query request. Once the search/query/lookup is complete and a set of documents is selected, "stored" is the set of fields whose values are available for display or return with the Solr response.

Part of the reason for the separation is that Solr/Lucene "analyzes" or transforms the input data into a more efficient form for faster and more relevant search/lookup. Unfortunately, that analyzed/transformed data is frequently no longer suitable for display and human consumption. In other words the analysis/transformation is not bidirectional/reversible. Setting "stored=true" guarantees that the original data can be retrieved in its original form.

Tags:

Solr

Solr4