Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (19 sloc) 2.31 KB

Storing data in index

After the tokenization and analysis process is complete, the resulting tokens are stored in an index, which is now ready to be search with. Only fields in the final index projection could be used for searches, and the actual tokens stored for each depend on how the selected Analyzer processed the original text.

Lucene allows storing the original token text for fields, and RavenDB exposes this feature in the index definition object via Stores.

By default, tokens are saved to the index as Indexed and Analyzed but not Stored - that is: they can be searched on using a specific Analyzer (or the default one), but their original value is unavailable after indexing. Enabling field storage causes values to be available for retrieval via the ProjectFromIndexFieldsInto, transformers, or other projection functions. It is done like this:

{CODE-TABS} {CODE-TAB:csharp:AbstractIndexCreationTask storing_1@Indexes\Storing.cs /} {CODE-TAB:csharp:Commands storing_2@Indexes\Storing.cs /} {CODE-TABS/}

Remarks

{INFO Default value in Stores for each field is FieldStorage.No. Keep in mind that storing fields will increase disk space required by an index. /}

{INFO:Info} If the projection function requires only the fields that are stored, then the document will not be loaded from storage and all data will come directly from the index. This can increase query performance (at the cost of disk space used) in the frequent situations when the whole document is not needed.

Raven/ImplicitFetchFieldsFromDocumentMode setting can be altered to change the behavior of field fetching. By default it allows fetching fields from document if index is missing them (they are not stored), but this can be changed to skipping those fields or even throwing an exception. Read more about this configuration option here. {INFO/}

Related articles

You can’t perform that action at this time.