Permalink
Browse files

Fixing build

Todo: Remove extraneous dependencies from core/project.json once dapper point the correct versions
  • Loading branch information...
sebastienros committed Apr 4, 2016
1 parent b3c83fd commit c146d9638c2ddea9df0a05fd646629ec321d0122
Showing with 519 additions and 391 deletions.
  1. +2 −2 .gitignore
  2. +1 −1 samples/YesSql.Bench/Program.cs
  3. +18 −6 samples/YesSql.Bench/project.json
  4. +9 −9 samples/YesSql.Samples.FullText/Indexes/ArticleByWord.cs
  5. +33 −32 samples/YesSql.Samples.FullText/Indexes/ArticleIndexProvider.cs
  6. +7 −7 samples/YesSql.Samples.FullText/Models/Article.cs
  7. +65 −58 samples/YesSql.Samples.FullText/Program.cs
  8. +11 −10 samples/YesSql.Samples.FullText/Tokenizers/ITokenFilter.cs
  9. +8 −7 samples/YesSql.Samples.FullText/Tokenizers/ITokenizer.cs
  10. +12 −12 samples/YesSql.Samples.FullText/Tokenizers/StopWordFilter.cs
  11. +26 −25 samples/YesSql.Samples.FullText/Tokenizers/WhiteSpaceTokenizer.cs
  12. +22 −8 samples/YesSql.Samples.FullText/project.json
  13. +8 −8 samples/YesSql.Samples.Hi/Indexes/BlogPostByAuthor.cs
  14. +9 −9 samples/YesSql.Samples.Hi/Indexes/BlogPostByDay.cs
  15. +39 −37 samples/YesSql.Samples.Hi/Indexes/BlogPostIndexProvider.cs
  16. +12 −12 samples/YesSql.Samples.Hi/Models/BlogPost.cs
  17. +83 −78 samples/YesSql.Samples.Hi/Program.cs
  18. +22 −8 samples/YesSql.Samples.Hi/project.json
  19. +10 −10 samples/YesSql.Samples.Performance/Program.cs
  20. +20 −7 samples/YesSql.Samples.Performance/project.json
  21. +24 −7 src/YesSql.Core/project.json
  22. +7 −6 src/YesSql.Storage.Cache/project.json
  23. +8 −0 src/YesSql.Storage.InMemory/InMemoryDocumentStorage.cs
  24. +4 −0 src/YesSql.Storage.InMemory/InMemoryDocumentStorageFactory.cs
  25. +7 −6 src/YesSql.Storage.InMemory/project.json
  26. +10 −2 src/YesSql.Storage.LightningDB/LightningDocumentStorage.cs
  27. +5 −1 src/YesSql.Storage.LightningDB/LightningDocumentStorageFactory.cs
  28. +7 −6 src/YesSql.Storage.LightningDB/project.json
  29. +3 −1 src/YesSql.Storage.Sql/SqlDocumentStorage.cs
  30. +7 −6 src/YesSql.Storage.Sql/project.json
  31. +1 −1 test/YesSql.Tests/Models/Animal.cs
  32. +19 −9 test/YesSql.Tests/project.json
View
@@ -21,6 +21,6 @@ artifacts
*.vsp
project.lock.json
*.mdb
.vs/
.build/
.vs/
.build/
.testPublish/
@@ -45,7 +45,7 @@ static void Main(string[] args)
session.Save(bill);
}
using (var session = _store.CreateSession())
@@ -4,21 +4,33 @@
"Microsoft.Data.Sqlite": "1.0.0-*",
"YesSql.Core": "2.0.0-*",
"YesSql.Storage.LightningDB": "1.0.0-*",
"xunit.assert": "2.1.0"
"xunit": "2.1.0"
},
"commands": {
"YesSql.Bench": "YesSql.Bench"
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
"System.Runtime": {
"type": "build"
},
"System.Reflection": {
"type": "build"
},
"System.Threading.Tasks": {
"type": "build"
}
}
},
"netstandardapp1.5": {
"dependencies": {
"NETStandard.Library": "1.0.0-*",
"System.Data.SqlClient": "4.0.0-*"
},
"imports": [
"dnxcore50",
"portable-net451+win8"
]
],
"dependencies": {
"NETStandard.Library": "1.5.0-*"
}
}
}
}
@@ -1,10 +1,10 @@
//using YesSql.Core.Indexes;
using YesSql.Core.Indexes;
//namespace YesSql.Samples.FullText.Indexes
//{
// public class ArticleByWord : ReduceIndex
// {
// public string Word { get; set; }
// public int Count { get; set; }
// }
//}
namespace YesSql.Samples.FullText.Indexes
{
public class ArticleByWord : ReduceIndex
{
public string Word { get; set; }
public int Count { get; set; }
}
}
@@ -1,35 +1,36 @@
//using System.Linq;
//using YesSql.Core.Indexes;
//using YesSql.Samples.FullText.Models;
//using YesSql.Samples.FullText.Tokenizers;
using System.Linq;
using YesSql.Core.Indexes;
using YesSql.Samples.FullText.Models;
using YesSql.Samples.FullText.Tokenizers;
//namespace YesSql.Samples.FullText.Indexes
//{
// public class ArticleIndexProvider : IndexProvider<Article>
// {
// public override void Describe(DescribeContext<Article> context)
// {
// var tokenizer = new WhiteSpaceTokenizer();
// var filter = new StopWordFilter();
namespace YesSql.Samples.FullText.Indexes
{
public class ArticleIndexProvider : IndexProvider<Article>
{
public override void Describe(DescribeContext<Article> context)
{
var tokenizer = new WhiteSpaceTokenizer();
var filter = new StopWordFilter();
// // for each BlogPost, create a BlogPostByAuthor index
// context.For<ArticleByWord, string>()
// .Map(article => filter
// .Filter(tokenizer.Tokenize(article.Content))
// .Select(x => new ArticleByWord {Word = x, Count = 1})
// )
// .Group(article => article.Word)
// .Reduce(group => new ArticleByWord
// {
// Word = group.Key,
// Count = group.Sum(y => y.Count)
// })
// .Delete((index, map) => {
// index.Count -= map.Sum(x => x.Count);
// for each BlogPost, create a BlogPostByAuthor index
context.For<ArticleByWord, string>()
.Map(article => filter
.Filter(tokenizer.Tokenize(article.Content))
.Select(x => new ArticleByWord { Word = x, Count = 1 })
)
.Group(article => article.Word)
.Reduce(group => new ArticleByWord
{
Word = group.Key,
Count = group.Sum(y => y.Count)
})
.Delete((index, map) =>
{
index.Count -= map.Sum(x => x.Count);
// // if Count == 0 then delete the index
// return index.Count > 0 ? index : null;
// });
// }
// }
//}
// if Count == 0 then delete the index
return index.Count > 0 ? index : null;
});
}
}
}
@@ -1,7 +1,7 @@
//namespace YesSql.Samples.FullText.Models
//{
// public class Article
// {
// public string Content { get; set; }
// }
//}
namespace YesSql.Samples.FullText.Models
{
public class Article
{
public string Content { get; set; }
}
}
@@ -1,58 +1,65 @@
//using System;
//using YesSql.Samples.FullText.Indexes;
//using YesSql.Samples.FullText.Models;
//using YesSql.Core.Services;
//using System.Data.SQLite;
//using YesSql.Core.Storage.InMemory;
//namespace YesSql.Samples.FullText
//{
// internal class Program
// {
// private static void Main(string[] args)
// {
// var store = new Store(cfg =>
// {
// cfg.ConnectionFactory = new DbConnectionFactory<SQLiteConnection>(@"Data Source=:memory:", true);
// cfg.DocumentStorageFactory = new InMemoryDocumentStorageFactory();
// cfg.Migrations.Add(builder => builder
// .CreateReduceIndexTable(nameof(ArticleByWord), table => table
// .Column<int>("Count")
// .Column<string>("Word")
// )
// );
// });
// // register available indexes
// store.RegisterIndexes<ArticleIndexProvider>();
// // creating articles
// using (var session = store.CreateSession())
// {
// session.Save(new Article {Content = "This is a white fox"});
// session.Save(new Article {Content = "This is a brown cat"});
// session.Save(new Article {Content = "This is a pink elephant"});
// session.Save(new Article {Content = "This is a white tiger"});
// }
// using (var session = store.CreateSession())
// {
// Console.WriteLine("Simple term: 'white'");
// var simple = session.QueryAsync<Article, ArticleByWord>().Where(a => a.Word == "white").List().Result;
// foreach (var article in simple) {
// Console.WriteLine(article.Content);
// }
// Console.WriteLine("Boolean query: 'white or fox or pink'");
// var boolQuery = session.QueryAsync<Article, ArticleByWord>().Where(a => a.Word.IsIn(new [] { "white", "fox", "pink" })).List().Result;
// foreach (var article in boolQuery)
// {
// Console.WriteLine(article.Content);
// }
// }
// }
// }
//}
using System;
using Microsoft.Data.Sqlite;
using YesSql.Core.Services;
using YesSql.Samples.FullText.Indexes;
using YesSql.Samples.FullText.Models;
using YesSql.Storage.InMemory;
namespace YesSql.Samples.FullText
{
internal class Program
{
private static void Main(string[] args)
{
var store = new Store(cfg =>
{
cfg.ConnectionFactory = new DbConnectionFactory<SqliteConnection>(@"Data Source=:memory:", true);
cfg.DocumentStorageFactory = new InMemoryDocumentStorageFactory();
});
store.InitializeAsync().Wait();
using (var session = store.CreateSession())
{
session.ExecuteMigration(x => x
.CreateReduceIndexTable(nameof(ArticleByWord), table => table
.Column<int>("Count")
.Column<string>("Word")
)
);
}
// register available indexes
store.RegisterIndexes<ArticleIndexProvider>();
// creating articles
using (var session = store.CreateSession())
{
session.Save(new Article { Content = "This is a white fox" });
session.Save(new Article { Content = "This is a brown cat" });
session.Save(new Article { Content = "This is a pink elephant" });
session.Save(new Article { Content = "This is a white tiger" });
}
using (var session = store.CreateSession())
{
Console.WriteLine("Simple term: 'white'");
var simple = session.QueryAsync<Article, ArticleByWord>().Where(a => a.Word == "white").List().Result;
foreach (var article in simple)
{
Console.WriteLine(article.Content);
}
Console.WriteLine("Boolean query: 'white or fox or pink'");
var boolQuery = session.QueryAsync<Article, ArticleByWord>().Where(a => a.Word.IsIn(new[] { "white", "fox", "pink" })).List().Result;
foreach (var article in boolQuery)
{
Console.WriteLine(article.Content);
}
}
}
}
}
@@ -1,11 +1,12 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//namespace YesSql.Samples.FullText.Tokenizers {
// public interface ITokenFilter
// {
// IEnumerable<string> Filter(IEnumerable<string> tokens);
// }
//}
namespace YesSql.Samples.FullText.Tokenizers
{
public interface ITokenFilter
{
IEnumerable<string> Filter(IEnumerable<string> tokens);
}
}
@@ -1,8 +1,9 @@
//using System.Collections.Generic;
using System.Collections.Generic;
//namespace YesSql.Samples.FullText.Tokenizers {
// public interface ITokenizer
// {
// IEnumerable<string> Tokenize(string text);
// }
//}
namespace YesSql.Samples.FullText.Tokenizers
{
public interface ITokenizer
{
IEnumerable<string> Tokenize(string text);
}
}
@@ -1,13 +1,13 @@
//using System.Collections.Generic;
//using System.Linq;
using System.Collections.Generic;
using System.Linq;
//namespace YesSql.Samples.FullText.Tokenizers
//{
// public class StopWordFilter : ITokenFilter
// {
// public IEnumerable<string> Filter(IEnumerable<string> tokens)
// {
// return tokens.Where(token => token.Length >= 2);
// }
// }
//}
namespace YesSql.Samples.FullText.Tokenizers
{
public class StopWordFilter : ITokenFilter
{
public IEnumerable<string> Filter(IEnumerable<string> tokens)
{
return tokens.Where(token => token.Length >= 2);
}
}
}
Oops, something went wrong.

0 comments on commit c146d96

Please sign in to comment.