Skip to content

Commit

Permalink
prevent new compat issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
nzdev committed Aug 16, 2023
1 parent 29f01ac commit 7a8049f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/Examine.Lucene/Providers/BaseLuceneSearcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,6 @@ public override IQuery CreateQuery(string? category = null, BooleanOperation def
#pragma warning restore RS0027 // API with optional parameter(s) should have the most parameters amongst its public overloads
=> CreateQuery(category, defaultOperation, LuceneAnalyzer, new LuceneSearchOptions());

/// <summary>
/// Creates an instance of SearchCriteria for the provider
/// </summary>
/// <param name="category">The type of data in the index.</param>
/// <param name="defaultOperation">The default operation.</param>
/// <param name="searchOptions">Lucene Search Options</param>
/// <returns></returns>
public IQuery CreateQuery(string category = null, BooleanOperation defaultOperation = BooleanOperation.And, LuceneSearchOptions searchOptions = null)
=> CreateQuery(category, defaultOperation, LuceneAnalyzer, searchOptions ?? new LuceneSearchOptions());

/// <summary>
/// Creates an instance of SearchCriteria for the provider
/// </summary>
Expand Down
13 changes: 13 additions & 0 deletions src/Examine.Test/Examine.Lucene/Search/SimilarityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Examine.Lucene;
using Examine.Lucene.Providers;
using Examine.Lucene.Search;
using Examine.Search;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Search.Similarities;
using NUnit.Framework;
Expand Down Expand Up @@ -35,6 +36,8 @@ public void Default_Similarity()
var searcher = (BaseLuceneSearcher)indexer.Searcher;

var query = searcher.CreateQuery("cOntent",
BooleanOperation.And,
searcher.LuceneAnalyzer,
searchOptions: new LuceneSearchOptions
{
SimilarityName = ExamineLuceneSimilarityNames.ExamineDefault
Expand Down Expand Up @@ -70,6 +73,8 @@ public void BM25_Similarity()
var searcher = (BaseLuceneSearcher)indexer.Searcher;

var query = searcher.CreateQuery("cOntent",
BooleanOperation.And,
searcher.LuceneAnalyzer,
searchOptions: new LuceneSearchOptions
{
SimilarityName = ExamineLuceneSimilarityNames.BM25
Expand Down Expand Up @@ -106,6 +111,8 @@ public void LMDirichlet_Similarity()
var searcher = (BaseLuceneSearcher)indexer.Searcher;

var query = searcher.CreateQuery("cOntent",
BooleanOperation.And,
searcher.LuceneAnalyzer,
searchOptions: new LuceneSearchOptions
{
SimilarityName = ExamineLuceneSimilarityNames.LMDirichlet
Expand Down Expand Up @@ -141,6 +148,8 @@ public void LMJelinekMercer_Title_Similarity()
var searcher = (BaseLuceneSearcher)indexer.Searcher;

var query = searcher.CreateQuery("cOntent",
BooleanOperation.And,
searcher.LuceneAnalyzer,
searchOptions: new LuceneSearchOptions
{
SimilarityName = ExamineLuceneSimilarityNames.LMJelinekMercerTitle
Expand Down Expand Up @@ -176,6 +185,8 @@ public void LMJelinekMercer_LongText_Similarity()
var searcher = (BaseLuceneSearcher)indexer.Searcher;

var query = searcher.CreateQuery("cOntent",
BooleanOperation.And,
searcher.LuceneAnalyzer,
searchOptions: new LuceneSearchOptions
{
SimilarityName = ExamineLuceneSimilarityNames.LMJelinekMercerLongText
Expand Down Expand Up @@ -244,6 +255,8 @@ public void Custom_PerField_Similarity()


var query = searcher.CreateQuery("cOntent",
BooleanOperation.And,
searcher.LuceneAnalyzer,
searchOptions: new LuceneSearchOptions
{
SimilarityName = "dictionarySim"
Expand Down

0 comments on commit 7a8049f

Please sign in to comment.