Skip to content

Instantly share code, notes, and snippets.

@pkrakowiak
Created February 28, 2013 12:45
Show Gist options
  • Save pkrakowiak/5056490 to your computer and use it in GitHub Desktop.
Save pkrakowiak/5056490 to your computer and use it in GitHub Desktop.
AND operator doesn't seem to be working in RavenDB Client. Details: https://groups.google.com/forum/?fromgroups=#!topic/ravendb/vU61Qh6j0o4
using Raven.Abstractions.Data;
using Raven.Tests.Helpers;
using Xunit;
namespace LuceneAnd.RavenTests
{
public class CanUseAndOperatorOnLuceneQuery : RavenTestBase
{
private class Place
{
public string Name { get; set; }
public string Descriptionn { get; set; }
}
[Fact]
public void WillUseAndOperator()
{
using (var store = NewDocumentStore())
{
using (var session = store.OpenSession())
{
var keywords = "state museum";
var query = session.Advanced.LuceneQuery<Place>()
.Search(x => x.Name, keywords).Boost(2)
.Search(x => x.Descriptionn, keywords)
.UsingDefaultOperator(QueryOperator.And);
Assert.Equal("Name:(state AND museum)^2 Description:(state AND museum)", query.ToString());
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment