Skip to content

Commit

Permalink
fixes issue with trying to set the rewrite method on queries that don…
Browse files Browse the repository at this point in the history
…'t support it
  • Loading branch information
Shazwazza committed Sep 15, 2017
1 parent f1770da commit 62e6542
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Examine/LuceneEngine/Providers/BaseLuceneSearcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,14 @@ protected void SetScoringBooleanQueryRewriteMethod(Query query)
{
if (query is MultiTermQuery mtq)
{
mtq.SetRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
}
if (query is FuzzyQuery trq)
{
trq.SetRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
try
{
mtq.SetRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
}
catch (NotSupportedException)
{
//swallow this, some implementations of MultiTermQuery don't support this like FuzzyQuery
}
}
if (query is BooleanQuery bq)
{
Expand Down

0 comments on commit 62e6542

Please sign in to comment.