Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SOLR Difference between indexed=true and stored=true

Tags:

java

solr

In SOLR, what is the difference between stored=true and indexed=true. I know that stored=true stores the actual value of the field without modifying it and indexed=true stores the modified value of the field for computation purposes. I would like to know, till what level it affects the performance. Does a combination of stored=true and indexed=true decrease performance of persistence and retrieval when compared to stored =false and indexed=true?

like image 926
Tanveer Dayan Avatar asked Mar 02 '15 09:03

Tanveer Dayan


1 Answers

indexed = true is needed if you like to search "over" that field. If a field is not indexed, so you can not find values/terms from that field. Your analyzer chain runs over the data on that field, if indexed = true.

stored = true is needed if you need read the values/content of a field from the index. For example, if you like to use highlighting feature or if you like to use solr as a database, and not just as a search index. If stored = true means: simply store the original content and output the original content, if needed.

I would like to know, till what level it affects the performance.

Content (stored) and index are placed in different files. So solr does not need to walk through content-files on searching, only because stored is true.

It takes some time to store the data, particularly if it is large. On the retrieval side, it depends on what you put into 'fl'. If you don't retrieve the field with 'fl', you don't incur a cost to read it.

But if the field is stored, so solr is able to print the content in the result-list (depending on your solr configuration). This means, that your result list could be much bigger (depending on you content/size of fields). Building the list and transferring the list to the client could be slower, if solr has to send the content of the stored field too.

The time for executing an search will be the same. But the whole time, that is needed by the request, is an addition of several things: searching, building result list, transferring the list to the client, etc. So storing all fields an output all the content into the result list could slower your solr request, but will not have an effect on the query time.

like image 189
The Bndr Avatar answered Sep 26 '22 01:09

The Bndr