Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RavenDB specify Lucene vs Corax in C# code

Tags:

c#

ravendb

I'm migrating from RavenDB 6.0.106 to 6.2.

I have a lot of complex indexes that are not compatible with Corax. Using the UI, one can set which index type is used.

However, after perusing the RavenDB site, I have yet to find how to specify this in C# code alone. Is this even possible? If so, how is it done? Where's the documentation?

like image 513
Display name Avatar asked Sep 20 '25 04:09

Display name


1 Answers

You can specify which search engine to use in 3 ways/levels:

  1. Setting the search engine server-wide (for all databases):
    update your settings.json file as shown in this link:
    https://ravendb.net/docs/article-page/6.2/csharp/indexes/search-engine/corax#select-search-engine-server-wide
  2. Setting the search engine per database:
    done via the Studio as shown in this link:
    https://ravendb.net/docs/article-page/6.2/csharp/indexes/search-engine/corax#select-search-engine-per-database
  3. Setting the search engine per index:
    can be done via the client API code as shown in this link:
    https://ravendb.net/docs/article-page/6.2/csharp/indexes/search-engine/corax#select-index-search-engine-using-code
    For example, set this in your index definition:
    SearchEngineType = Raven.Client.Documents.Indexes.SearchEngineType.Corax;
    Or
    SearchEngineType = Raven.Client.Documents.Indexes.SearchEngineType.Lucene;
like image 193
Danielle Avatar answered Sep 22 '25 19:09

Danielle