Swift SDK: Please Improve Indexing Docs

Can we get improved documentation for the indexing APIs in the Swift SDK? Here’s what’s there right now:

Questions the Docs should answer:

  1. Why would indexes() throw?

  2. Under what conditions do the other functions throw? For example, if I call createIndex using a name that already exists as an index, does that throw? Is it a no-op? What if the configuration I pass is different? (e.g. the existing index under the name “foo” has a single property but I now want to create an index named “foo” that has multiple properties.) Is the index replaced? Do I have to delete the old index before I can create its replacement?

  3. Are these functions expected to return immediately and index construction then happens in the background? The Couchbase server docs state that index creation is async. Is that true for the Couchbase Lite SDKs as well?

The docs here leave a lot unspecified. Could you please document the behavior, in detail, so that developers know what to expect from these APIs? Thanks.

1 Like

Thank you for the suggestion! Created CBL-7035 to track this.

To try and answer you questions:

  1. It will throw when collection is invalid or database is closed.
  2. The index will get replaced when trying to create a index with a name that is already used by another index. You don’t have to delete the “older” index.
  3. Index creation is not asynchronous for Lite
1 Like