Index Name - An index name can be composed of letters, digits, ., /, -, and _. The name must be unique in the scope of the database.
Uniqueness is evaluated in a case-insensitive way - you can't create indexes named both usersbyname and UsersByName.
The characters _ and / are treated as equivalent - you can't create indexes named both users/byname and users_byname.
If the index name contains the character ., it must have some other character on both sides to be valid. /./ is a valid index name, but
./, /., and /../ are all invalid.
Save - Save index definition Clone - Clone this index (available for an already saved index) Delete - Delete this index (available for an already saved index)
Options avaliable for an already saved index: Copy C# - Click to view and copy the C# class that defines the index as set in the Studio. Query - Click to go the the Query View and query this index. Terms - Click to see the index terms, see below.
The Map Function of the index.
In the above example, the index will go over documents from the Products collection and
will only index documents whose Discontinued property is 'true'.
Note: The range of documents from which the query on this index will supply results will be on only Products collection documents
that have 'true' in the 'Discontinued' document field property. If the index was defined without the 'where' clause, but only using 'from p in docs.Products',
then the documents range for the query result would have been the whole Products collection.
Each Index Entry that will be created for this index will be composed of the following 4 fields: Name, Category, PricePerUnit & SupplierName.
The first 3 are taken directly from the document fields, while SupplierName is a calculated index field.
The supplier's name is derived from the Name field that is taken from the loaded supplier document.
At query time, when querying this index, the resulting documents can be searched on and further filtered
by these Index Fields defined and by the created Terms.
See the query results on this index in Query View.
The index-fields that are indexed per index-entry with the above index-definition are: Name, Category, PricePerUnit & SupplierName.
The terms are listed under each field.
The terms are created from the value of the field that was requested to be indexed
according to the specified Field Options.
Index Field Options
Figure-4: Index Field Options
Set the default values that will apply to all index fields.
Add a Field
Override the default values with specific settings for selected index entries.
Select a field from the drop-down. The settings will override the default settings.
Store - Setting 'Store' will store the value of this field in the index itself.
At query time, if 'Store' is set, then the value is fetched directly from the index, instead of from the original document.
If the field value is not stored in the index then it will be fetched from the document.
Storing data in the index will increase the index size.
Learn more in Storing Data in Index.
Full-Text-Search - Set this to 'Yes' to allow searching for a particular text without having an exact match.
The terms that are being indexed are tokens that are split from the original string according to the specified Analyzer.
The Analyzer is set in the 'Indexing' dropdown. The default analyzer is a simple case-insensitive analyzer.
Indexing - Specify which Analyzer will be used (under Advanced):
Exact - A no-operation analyzer. Text is not splitted and matches are case-sensitive.
Default - 'LowerCaseKeywordAnalyzer' is used. Matches are case-insensitive, the input string is converted to lowercase.
Search - Set a specific analyzer to use.
The default option is 'StandardAnalyzer'. Input strings are broken into individual terms on a word boundary and are lowercased,
while omitting the 'stop words' (a, the, to, from, is, are, etc.) as well as possessive “s”.
Details about the available analyzers can be found in Indexes: Analyzers.
Suggestions - Setting 'Suggestions' will allow you to query what the user probably meant to ask about. i.e. spelling errors.
Learn more in this Blog Post,
and in Querying: Suggestions.
Term Vector - Term Vectors (under Advanced) are used in RavenDB's query feature More Like This,
which suggests documents that are similar to a selected document, based on shared indexed terms. i.e. suggest similar catalogs.
A 'Term Vector' for a text paragraph will contain a list of all unique words and how often they appeared.
Set 'full-text-search' on the field (index entry) and define it to have a 'Term Vector'.
Learn more in Indexes: Term Vectors,
and in this Blog Post.
Use the Additional Sources feature to introduce additional classes and methods that can be used in the index definition.
This enables advanced scenarios since complex logic can be performed in the indexing process.
In the above example, file 'PeopleUtil.cs' was uploaded and method 'CalculatePersonEmail' is used to calculate the index entry 'SupplierEmail'.
Spatial Field Options
Figure-6: Spatial Field Options
Spatial searches allow you to search using geographical data.
In order to be able to do such searches, a spatial index field has to be defined.
This method instructs RavenDB to use the provided longitude and latitude from the document field properties
and create the spatial field named 'Coordinates'.
Spatial queries can then be made on the 'Coordinates' field.
RavenDB supports both the 'Geography' and 'Cartesian' systems.
Spatial Indexing Strategy 'Strategy' determines the format of the indexed term values.
The following indexing strategies are supported:
• Bounding box
• Geohash prefix tree
• Quad prefix tree
Set the units (miles, kilometers) to be used when querying with RQL 'spatial.circle'.
Learn more about querying spatial fields in: Querying: Spatial.
Max Tree Level
Control how precise the spatial queries are going to be.
X & Y Min & Max Values
Setting the min & max values for X & Y is relevant only for the 'Cartesian' system type.