Skip to content

Commit

Permalink
Adds Id query
Browse files Browse the repository at this point in the history
  • Loading branch information
Shazwazza committed Dec 21, 2023
1 parent a72e67c commit 56c8971
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/Examine.Test/Examine.Lucene/Search/FluentApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2200,6 +2200,34 @@ public void Category()
}
}

[Test]
public void By_Id()
{
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 = "type1" })
});

var searcher = indexer.Searcher;

var query = searcher.CreateQuery().Id(2.ToString());
Console.WriteLine(query);

var results = query.Execute();

//Assert
Assert.AreEqual(1, results.TotalItemCount);
}
}

[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()
Expand Down

0 comments on commit 56c8971

Please sign in to comment.