Skip to content

Commit

Permalink
Index restriction explained with example
Browse files Browse the repository at this point in the history
Added warning about creating new indexes on already indexed fields.
  • Loading branch information
anidotnet committed Feb 28, 2024
1 parent db9e869 commit 0b97449
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flutter-sdk/collection/indexing.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ One of such custom index implementation can be found in spatial module. It provi

You can create an index on a collection using `createIndex()` method. There are several overloaded version of `createIndex()` method. You can create an index on a single field or multiple fields.

!!!warning
You cannot create a new index on a field or a set of fields which is already indexed with a different type of index.

For example, if you have a unique index on `firstName` field, then you cannot create a non-unique index on `firstName` field. But you can create a unique index on `firstName` and `lastName` fields.
Similarly, if you have a unique index on `firstName` and `lastName` fields, then you cannot create a non-unique index on `firstName` and `lastName` fields. But you can create two indexes on `firstName` and `lastName` fields separately.
!!!

### Creating a Unique Index

You can create a unique index on a single field or multiple fields. It takes the name of the fields on which the index will be created as input parameter.
Expand Down
7 changes: 7 additions & 0 deletions flutter-sdk/repository/indexing.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ You can also create your own custom index. More information about custom index c

You can define indexes for an entity using annotations. You can also create indexes using `ObjectRepository` interface.

!!!warning
You cannot create a new index on a field or a set of fields which is already indexed with a different type of index.

For example, if you have a unique index on `firstName` field, then you cannot create a non-unique index on `firstName` field. But you can create a unique index on `firstName` and `lastName` fields.
Similarly, if you have a unique index on `firstName` and `lastName` fields, then you cannot create a non-unique index on `firstName` and `lastName` fields. But you can create two indexes on `firstName` and `lastName` fields separately.
!!!

### Creating a Unique Index

You can create a unique index on a single field or multiple fields. It takes the name of the fields on which the index will be created as input parameter.
Expand Down
7 changes: 7 additions & 0 deletions java-sdk/collection/indexing.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ One of such custom index implementation can be found in spatial module. It provi

You can create an index on a collection using `createIndex()` method. There are several overloaded version of `createIndex()` method. You can create an index on a single field or multiple fields.

!!!warning
You cannot create a new index on a field or a set of fields which is already indexed with a different type of index.

For example, if you have a unique index on `firstName` field, then you cannot create a non-unique index on `firstName` field. But you can create a unique index on `firstName` and `lastName` fields.
Similarly, if you have a unique index on `firstName` and `lastName` fields, then you cannot create a non-unique index on `firstName` and `lastName` fields. But you can create two indexes on `firstName` and `lastName` fields separately.
!!!

### Creating a Unique Index

You can create a unique index on a single field or multiple fields. It takes the name of the fields on which the index will be created as input parameter.
Expand Down
7 changes: 7 additions & 0 deletions java-sdk/repository/indexing.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ You can also create your own custom index. More information about custom index c

You can define indexes for an entity using annotations. You can also create indexes using `ObjectRepository` interface.

!!!warning
You cannot create a new index on a field or a set of fields which is already indexed with a different type of index.

For example, if you have a unique index on `firstName` field, then you cannot create a non-unique index on `firstName` field. But you can create a unique index on `firstName` and `lastName` fields.
Similarly, if you have a unique index on `firstName` and `lastName` fields, then you cannot create a non-unique index on `firstName` and `lastName` fields. But you can create two indexes on `firstName` and `lastName` fields separately.
!!!

### Creating a Unique Index

You can create a unique index on a single field or multiple fields. It takes the name of the fields on which the index will be created as input parameter.
Expand Down

0 comments on commit 0b97449

Please sign in to comment.