Skip to content

Commit

Permalink
commit ignored test
Browse files Browse the repository at this point in the history
  • Loading branch information
Shazwazza committed Dec 20, 2023
1 parent 5004b13 commit a72e67c
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/Examine.Test/Examine.Lucene/Search/FluentApiTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Examine.Lucene.Providers;
using Examine.Lucene.Search;
using Examine.Search;
Expand Down Expand Up @@ -2198,6 +2200,55 @@ public void Category()
}
}

[Ignore("This test needs to be updated to ensure that searching calls GetFieldInternalQuery with useQueryParser = false, see https://github.com/Shazwazza/Examine/issues/335#issuecomment-1834677581")]
[Test]
public void Query_With_Category_Multi_Threaded()
{
var analyzer = new StandardAnalyzer(LuceneInfo.CurrentVersion);
using (var luceneDir = new RandomIdRAMDirectory())
using (var indexer = GetTestIndex(luceneDir, analyzer))
{
indexer.IndexItems(new[] {
ValueSet.FromObject(1.ToString(), "content",
new { Content = "hello world", Type = "type1" }),
ValueSet.FromObject(2.ToString(), "content",
new { Content = "hello something or other", Type = "type1" }),
ValueSet.FromObject(3.ToString(), "content",
new { Content = "hello you guys", Type = "type3" }),
ValueSet.FromObject(4.ToString(), "media",
new { Content = "hello you cruel world", Type = "type2" }),
ValueSet.FromObject(5.ToString(), "media",
new { Content = "hi there, hello world", Type = "type2" })
});

var searcher = indexer.Searcher;

var tasks = Enumerable.Range(0, 1)
.Select(x => new Task(() =>
{
var criteria = searcher.CreateQuery("content", BooleanOperation.And);
IBooleanOperation examineQuery;
examineQuery = criteria
.GroupedOr(new string[] { "Type" }, "type1", "type2")
.And()
.Field("Content", "hel".MultipleCharacterWildcard());

var results = examineQuery.Execute();

//Assert
Console.WriteLine(results.TotalItemCount + ", Thread: " + Thread.CurrentThread.ManagedThreadId);
Assert.AreEqual(2, results.TotalItemCount);
}))
.ToArray();

Parallel.ForEach(tasks, x => x.Start());

Task.WaitAll(tasks);

Assert.IsTrue(tasks.All(x => x.IsCompletedSuccessfully));
}
}

//[Test]
//public void Wildcard_Results_Sorted_By_Score()
//{
Expand Down

0 comments on commit a72e67c

Please sign in to comment.