Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6568313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:27:43+00:00 2026-05-25T14:27:43+00:00

I have documents collection Messages in my base (RavenDB) Document definition like: class Message

  • 0

I have documents collection “Messages” in my base (RavenDB)
Document definition like:

class Message
{
    string Content;
    Tag[] Tags;
    Location[] Locations;
    string[] Actions;
    bool IsActive;
}

Tag class definition:

class Tag
{
    string Value;
    Translation[] Translations;
}

Location class:

class Location
{
    string Code;
    Translation[] Translations;
}

Translation class:

class Translation
{
    string LanguageCode;
    string Value;
}

So, I want to create a index that will allow me to make queries by several fields:

  1. Full-text search by Message.Content
  2. Only messages with IsActive==true
  3. Messages that contains my action in Message.Actions
  4. Messages that contains tag with myValue and myLanguageCode
  5. Locations that contains location with some myCode and myLanguageCode

I would like to query to be on all the conditions simultaneously

So, how should i define index for RavenDB?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:27:43+00:00Added an answer on May 25, 2026 at 2:27 pm

    Well, after a short studies of RavenDB auto dynamic indexes i created something like

    new IndexDefinition
    {
        Map = @"
         from doc in docs.Messages 
          where IsActive==true
         from docActionsItem in (IEnumerable<dynamic>)doc.Actions
         from docTagsItem in (IEnumerable<dynamic>)doc.Tags 
         from docTagsItemTranslationsItem in (IEnumerable<dynamic>)docTagsItem.Translations
         from docLocationsItem in (IEnumerable<dynamic>)doc.Locations
         from docLocationsItemTranslationsItem in (IEnumerable<dynamic>)docLocationsItem.Translations
         select new { 
          TagsValue = docTagsItem.Value, 
          Content = doc.Content, 
          Actions=docActionsItem, 
          TagsTranslationsLanguageCode = docTagsItemTranslationsItem.LanguageCode,
          TagsTranslationsValue = docTagsItemTranslationsItem.Value, 
          LocationsCode = docLocationsItem.Code, 
          LocationsTranslationsLanguageCode=docLocationsItemTranslationsItem.LanguageCode,
          LocationsTranslationsValue=docLocationsItemTranslationsItem.Value
         }",
        Analyzers =
            {
                {"Content", typeof(StandardAnalyzer).FullName},                                    
            }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have collection of documents Message in RavenDB. Definition: class Message { string Content;
I have an object like follows: @connection.register class User(Document): __collection__ = 'users' __database__ =
I have a large collection of documents scanned into PDF format, and I wish
I have a collection of HTML documents for which I need to parse the
I have a collection of data stored in XDocuments and DataTables, and I'd like
I have text documents like the following which contain single and multiple variables: title::
I have some XML: <messages> <message> <meta appid=1112 date=20111028 msgid=4498016 msgno=855 permlinkdate=2011-10-28> <summary>RedBook is
I have collection of documents, witch has an array, of embedded documents, how i
We have a collection of log data, where each document in the collection is
We have hundreds of document libraries, spread all throughout various site collections in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.