public void WhenExactToleranceMatches_ShouldReturnCompositeMatch() { var left = IntermediateQueryResult(ScoredToken(7, ScoredFieldMatch(1D, 1, 30))); var right = IntermediateQueryResult(ScoredToken(7, ScoredFieldMatch(1D, 1, 35))); var result = CompositePositionalIntersectMerger.Apply(left, right, 0, 5); result.Should().BeEquivalentTo( ScoredToken(7, ScoredFieldMatch(2D, 1, (30, 35))) ); }
public void WhenExactRightToleranceMatchesOnlyForSomeFields_ShouldOnlyReturnCompositeMatchesForCorrectTokens() { var result = CompositePositionalIntersectMerger.Apply(exactMatchLeft, exactMatchRight, 0, 5); result.Should().BeEquivalentTo( ScoredToken( 7, ScoredFieldMatch(2D, 1, (30, 35)), ScoredFieldMatch(4D, 2, (5, 10)))); }
public void ShouldReturnMatchesInMinTokenIndexOrder() { var left = IntermediateQueryResult(ScoredToken(7, ScoredFieldMatch(1D, 1, 30, 41))); var right = IntermediateQueryResult(ScoredToken(7, ScoredFieldMatch(1D, 1, 35, 37, 42))); var result = CompositePositionalIntersectMerger.Apply(left, right, 5, 5); var matchedLocations = result.SelectMany(r => r.FieldMatches.SelectMany(m => m.Locations)).ToList(); matchedLocations.Should().HaveCount(3); matchedLocations.Select(l => l.MinTokenIndex) .Should().BeInAscendingOrder(); }
public void WhenExactLeftToleranceMatchesOnlyForSomeFields_ShouldOnlyReturnCompositeMatchesForCorrectTokens() { var result = CompositePositionalIntersectMerger.Apply(exactMatchLeft, exactMatchRight, 5, 0); result.Should().BeEquivalentTo(new[]