This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var documentStore = new DocumentStore { Url = "http://localhost:8080" }) | |
{ | |
documentStore.Initialise(); | |
using (var session = documentStore.OpenSession()) | |
{ | |
//Only add the index if there are not posts in the database, i.e. the 1st time this is run!! | |
if (session.Query<Post>().Count() == 0) | |
{ | |
Console.WriteLine("First time usage, creating indexes"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Dynamic; | |
using System.Linq.Expressions; | |
using System.Diagnostics; | |
namespace Raven.Client.Tests.Document | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var store = NewDocumentStore()) | |
{ | |
using (var s = store.OpenSession()) | |
{ | |
s.Store(new Post | |
{ | |
//Create an empty list that we can add items to later | |
Comments = new List<Comment>() | |
}); | |
s.SaveChanges(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Globalization; | |
using System.Threading; | |
using Lucene.Net.Analysis; | |
using Lucene.Net.Documents; | |
using Lucene.Net.Index; | |
using Lucene.Net.QueryParsers; | |
using Lucene.Net.Search; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void RunSnippet() | |
{ | |
var wholeString = "daab"; | |
var prefix = "da"; | |
WL("{0}.StartsWith({1}) = {2}", wholeString, prefix, wholeString.StartsWith(prefix)); | |
WL("{0}.StartsWith({1}, StringComparision.InvariantCulture) = {2}", wholeString, prefix, | |
wholeString.StartsWith(prefix, StringComparison.InvariantCulture)); | |
WL("-------------------------"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
var dir = new RAMDirectory(); | |
var analyzer = new KeywordAnalyzer(); | |
var writer = new IndexWriter(dir, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED); | |
var fields = new[] | |
{ | |
"MRS. SHABA", "MRS. SHABA", "MRS. SMITH", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using Raven.Abstractions.Data; | |
using Raven.Abstractions.Indexing; | |
using Raven.Client; | |
using Raven.Client.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using Raven.Abstractions.Data; | |
using Raven.Abstractions.Indexing; | |
using Raven.Client; | |
using Raven.Client.Linq; | |
using Raven.Client.Indexes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var numItems = 100000; | |
var dictionary = new Dictionary<string, Foo>(numItems); | |
for (int i = 0; i < numItems; i++) | |
{ | |
var foo = new Foo { Id = "foo/" + i.ToString(), Counter = i + 1, Data = "Some Data " + i.ToString() }; | |
dictionary.Add(foo.Id, foo); | |
} | |
var timer = Stopwatch.StartNew(); | |
var jsonObj = RavenJObject.FromObject(dictionary); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void DictionaryTest() | |
{ | |
var store = new EmbeddableDocumentStore | |
{ | |
RunInMemory = true | |
}; | |
store.Configuration.TempIndexPromotionMinimumQueryCount = 1; | |
store.Initialize(); | |
var entry1 = new ClassWithDictionary { Name = "With test", Dictionary = new Dictionary<string, string> { { "test", "value" } } }; | |
var entry2 = new ClassWithDictionary { Name = "Without test", Dictionary = new Dictionary<string, string> { { "nottest", "value" } } }; |
OlderNewer