Permalink
Browse files

Merge branch 'master' of ..\ravendb

  • Loading branch information...
2 parents 863402c + 5df711c commit e69c386b5df9fdfd4dea01d36982277b6e3f432a @ayende ayende committed Sep 16, 2011
View
4 Raven.Client.Embedded/EmbeddableDocumentStore.cs
@@ -114,7 +114,9 @@ protected override void SetConnectionStringSettings(RavenConnectionStringOptions
if (embeddedRavenConnectionStringOptions == null)
return;
- DataDirectory = embeddedRavenConnectionStringOptions.DataDirectory;
+ if (string.IsNullOrEmpty(embeddedRavenConnectionStringOptions.DataDirectory) == false)
+ DataDirectory = embeddedRavenConnectionStringOptions.DataDirectory;
+
RunInMemory = embeddedRavenConnectionStringOptions.RunInMemory;
}
View
83 Raven.Tests/Bugs/Matthew.cs
@@ -0,0 +1,83 @@
+using System.Linq;
+using Raven.Client.Document;
+using Raven.Client.Indexes;
+using Raven.Database;
+using Xunit;
+
+namespace Raven.Tests.Bugs
+{
+ public class Matthew : RavenTest
+ {
+ [Fact]
+ public void CanUseLuceneQueryToQueryIndex()
+ {
+ using(GetNewServer())
+ using(var store = new DocumentStore
+ {
+ DefaultDatabase = "TESTS",
+ Url = "http://localhost:8080"
+ }.Initialize())
+ {
+ store.Conventions.FindTypeTagName = type =>
+ {
+ if (typeof(Oil).IsAssignableFrom(type))
+ return "oils";
+ if (typeof(User).IsAssignableFrom(type))
+ return "users";
+ if (typeof(Feedback).IsAssignableFrom(type))
+ return "feedback";
+ return "unknown_add_to_global.asax.cs";
+ };
+ new PopularOilsIndex().Execute(store);
+
+
+
+ using(var sesison = store.OpenSession())
+ {
+ var popularOilsResults = sesison.Query<PopularOilsResult, PopularOilsIndex>()
+ .Customize(x => x.WaitForNonStaleResultsAsOfNow())
+ .OrderByDescending(x => x.Count).Take(10)
+ .ToList();
+ }
+
+ }
+ }
+
+ public class PopularOilsIndex : AbstractIndexCreationTask<User, PopularOilsResult>
+ {
+ public PopularOilsIndex()
+ {
+ Map = users => from user in users
+ from oil in user.Favorites
+ select new { OilId = oil, Count = 1 };
+ Reduce = results => from result in results
+ group result by result.OilId into g
+ select new
+ {
+ OilId = g.Key,
+ Count = g.Sum(x => x.Count)
+ };
+ }
+ }
+
+
+ public class User
+ {
+ public Oil[] Favorites { get; set; }
+ }
+ public class PopularOilsResult
+ {
+ public string OilId { get; set; }
+ public int Count { get; set; }
+ }
+ public class Oil
+ {
+ }
+
+
+ public class Feedback
+ {
+ }
+ }
+
+}
View
1 Raven.Tests/Raven.Tests.csproj
@@ -190,6 +190,7 @@
<Compile Include="Bugs\MapRedue\Document.cs" />
<Compile Include="Bugs\MapRedue\DocumentView.cs" />
<Compile Include="Bugs\MapRedue\MapReduceIndex.cs" />
+ <Compile Include="Bugs\Matthew.cs" />
<Compile Include="Bugs\MetadataIssues.cs" />
<Compile Include="Bugs\Metadata\Querying.cs" />
<Compile Include="Bugs\MultiMap\Errors.cs" />

0 comments on commit e69c386

Please sign in to comment.