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 6586889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:50:54+00:00 2026-05-25T16:50:54+00:00

I have quite simple model: public class PhraseMeta: { public int Id { get;

  • 0

I have quite simple model:

public class PhraseMeta:
{
 public int Id { get; set; }
 public string ModuleName { get; set; }
 public string Description { get; set; }
 public DateTime ModifiedDate { get; set; }
}

public class Phrase
{
  public int Id { get; set; }
  public int PhraseMetaId { get; set; } //reference to PhraseMeta
  public string Language { get; set; }
  public string Text { get; set; }
}

Phrase contains some translations and PhraseMeta has meta information for several Phrases.
I am trying to find Phrase’s Text having ModuleName and Language.
As I understood RavenDB’s Multi Maps / Reduce indexes feature can help with it instead of using WhereEntityIs.
My index is:

public class PhraseEntry
{
  public string MetaId { get; set; }
  public string ModuleName { get; set; }
  public string Language { get; set; }
  public string Text { get; set; } 
}

public class PhraseTranslationIndex : AbstractMultiMapIndexCreationTask<PhraseEntry>
{
  public PhraseTranslationIndex()
  {
    this.AddMap<PhraseMeta>(phraseMetas => from pm in phraseMetas
                 select new
                 {
                   MetaId = pm.Id,
                   ModuleName = pm.ModuleName,
                   Language = (string)null,
                   Text = (string)null
                 });

    this.AddMap<Phrase>(phrases => from phrase in phrases
               select new
               {
                 MetaId = phrase.PhraseMetaId,
                 ModuleName = (string)null,
                 Language = phrase.Language,
                 Text = phrase.Text
               });

    this.Reduce = results => from entry in results
                 group entry by entry.MetaId
                   into g
                   select new
                   {
                     MetaId = g.Key,
                     ModuleName = g.Select(x => x.ModuleName).Where(x => x != null).First(),
                     Language = g.Select(x => x.Language).Where(x => x != null).First(),
                     Text = g.Select(x => x.Text).Where(x => x != null).First()
                   };

    this.Index(x => x.ModuleName, FieldIndexing.Analyzed);
    this.Index(x => x.Language, FieldIndexing.Analyzed);
    this.Index(x => x.Text, FieldIndexing.Analyzed);
  }
}

This is how I am trying to use it:

var entry = documentSession.Query<PhraseEntry, PhraseTranslationIndex>
                           .Where(p => p.ModuleName == "MyModule")
                           .Where(p => p.Language == "en")
                           .FirstOrDefault();

And this index has no results. I am using build 472.

Any ideas?

  • 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-25T16:50:55+00:00Added an answer on May 25, 2026 at 4:50 pm

    The problem is probably that you are using First(), try using FirstOrDefault()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple class CustomQuoteRequest: public class CustomQuoteRequest { private String requestId; private
What I want to do is quite simple: I have a model which I
I'm writing an MVC2 app using DataAnnotations. I have a following Model: public class
The question is quite simple : I have a controller plugin for Zend Framework.
My problem is quite simple: I have a 400MB file filled with 10,000,000 lines
I am stuck with something quite simple but really annoying: I have an xml
I am trying to accomplish something that seemed quite simple... I have 3 div
I have a written a very simple UDP Server using Netty - it quite
Have a look a this simple example. I don't quite understand why o1 prints
I have the following lines in my ~/.emacs.d/init.el (custom-set-variables '(flymake-allowed-file-name-masks (quote ( (\\.cc\\' flymake-simple-make-init)

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.