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

  • Home
  • SEARCH
  • 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 8738545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:45:14+00:00 2026-06-13T10:45:14+00:00

Say I had a User class like this: public class User { public bool

  • 0

Say I had a User class like this:

public class User
{
  public bool IsActive {get;set;}
  public string[] Tags{get;set;}
  public string Description {get;set;}
}

I would like to use RavenDB to search for the set of users that match following criteria:

  • IsActive = true
  • Tags contains both ‘hello‘ and ‘world‘
  • Description has the following phrase ‘abject failure‘

I have researched the Lucene Query syntax, I have even got some stuff working, but it all feels dreadfully clunky with lots of combinatorial string-building to create a text-based lucene query string. I hesitate to put my code up here because it is quite smelly.

I think what I want to do it submit a Lucene Search for the Description and Tags and then filter it with a Where clause for the IsActive field, perhaps like this Filter RavenDB Search Results. But I got lost.

I am using the latest official release (960) so all the groovy stuff that comes after this is not available to me yet. For example, this solution is verboten as 960 does not appear to support the .As<T>() extension.

Question

How do I construct the required Index and Query to perform a search that combines:

  • a single constraint, eg IsActive
  • a collection constraint, eg Tags
  • a free-text constraint eg Description

to return a strongly typed list of User objects?

Thank you for any code examples or pointers.

  • 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-06-13T10:45:15+00:00Added an answer on June 13, 2026 at 10:45 am

    You query it like this:

    var results = (from u in Session.Query<User>("YourUserIndex")
                  where u.IsActive && u.Tags.Any(x=>x == "hello") && x.Tags.Any(x=>x=="world")
                  select u)
                  .Search(x=>x.Description, "abject failure")
                  .ToList();
    

    Where YourUserIndex looks like this:

    from u in docs.Users
    select new { u.IsActive, u.Tags, u.Description };
    

    And you need to mark the Description field as analyzed.

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

Sidebar

Related Questions

Say I had a class: public class Post { public int PostId { get;
Looking for a non-JS solution. Say I had something like this: <ul> <li> <form>
So lets say I had a string that was <html> <head><title>301 Moved Permanently</title><head> and
I had a, lets say, deficient program design/architecture class in undergrad and thus am
This code is from the MapCallouts demo. Say I had hundreds of different annotations.
I have a data access API that say looks something like: public interface IDataAccess
Let's say I had the email address like putin-crab@президент.рф How to validate that address
I would like to get some opinions on when/if it is ok to put
Say I had the two tables below, how do I find all questions with
Say I had the following HTML: <h2>Heading <span></span></h2> <ul> <li><a href=# title=I am wanting

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.