Skip to content

Instantly share code, notes, and snippets.

View lynxz's full-sized avatar

Anders Strömberg lynxz

  • Consid
  • Sweden
View GitHub Profile
@lynxz
lynxz / FetchingWaferResults.cs
Created July 27, 2018 07:33
Fetching the result data for a specific wafer.
void Main()
{
using (var store = new DocumentStore { Urls = new[] { "http://swe-raventest:8080" } }.Initialize())
{
string waferId = "5809";
using (var session = store.OpenSession("S9"))
{
var timer = Stopwatch.StartNew();
var docs = session.Query<ProcessStepResult>("ProcessStep/Search")
@lynxz
lynxz / BatchSearch.cs
Last active July 18, 2018 07:57
Index for batch searching
namespace SomeNamespace {
public class BatchSearch : AbstractIndexCreationTask<ProcessStepDocument, BatchResult> {
public BatchSearch( ) {
Map = docs => from doc in docs
let tests = LoadDocument<StepExecutions>( doc.StepExecutionsId )
where !string.IsNullOrWhiteSpace( doc.Batch )
where tests.Runs.Where( r => r.Batch == doc.Batch ).All( d => d.TimeTicks <= doc.StopTimeTicks )
select new BatchResult {
@lynxz
lynxz / LuceneExstensions.cs
Created February 16, 2018 06:25
Extends RavenDB 4.0 IDocumentQuery to parse longer lucene strings into RQL
using System;
using System.Collections.Generic;
using System.Linq;
using Raven.Client.Documents.Session;
namespace Finisar.Phoenix.Raven {
public static class LuceneExstensions {
public static IDocumentQuery<T> WhereLucene<T>( this IDocumentQuery<T> query, string luceneQuery ) {
var luceneParser = new LuceneParser( luceneQuery );
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
namespace AnalyzeFile {
class Program {
const int IdSize = 8;
@lynxz
lynxz / UglyTest.cs
Last active September 9, 2016 07:07
Bulkinsert on RavenDB 2.5
void Main()
{
var store = new EmbeddableDocumentStore();
store.RunInMemory = true;
using (store.Initialize())
{
var index = new DocumentIndex();
index.Execute(store);
var docs = Enumerable.Range(0, 100000).Select(i => new SomeClass { Value = "Doc: " + i}).ToList();