コード例 #1
0
        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)))
                );
        }
コード例 #2
0
        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))));
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        public void WhenExactLeftToleranceMatchesOnlyForSomeFields_ShouldOnlyReturnCompositeMatchesForCorrectTokens()
        {
            var result = CompositePositionalIntersectMerger.Apply(exactMatchLeft, exactMatchRight, 5, 0);

            result.Should().BeEquivalentTo(new[]