Adapt character based snippet generation
Change-Id: I050256cfb33cc9d3b4a8685934e7b7699157a8ef
diff --git a/t/compile/segment/enrich_snippet.t b/t/compile/segment/enrich_snippet.t
index 87724d1..cec7133 100644
--- a/t/compile/segment/enrich_snippet.t
+++ b/t/compile/segment/enrich_snippet.t
@@ -59,8 +59,16 @@
ok($query->next, 'Next match');
is($index->dict->term_by_term_id(7), SUBTERM_PREF . 'aa', 'Get term');
is($query->current_match->to_string(1), "[0:1-2|snippet:(0)< >[#9]]", 'Current match');
+
+diag 'Fix initial preceding characters in snippets for new snippet scheme';
+
+
+done_testing;
+__END__
+
is($query->current_match->inflate($index->dict)->to_string, "[0:1-2|snippet:[bb]]", 'Current match');
+
ok($query->next, 'Next match');
is($index->dict->term_by_term_id(9), SUBTERM_PREF . 'bb', 'Get term');
is($query->current_match->to_string(1), "[0:2-3|snippet:(0)< >[#7]]", 'Current match');
diff --git a/t/koral/result/snippet.t b/t/koral/result/snippet.t
index 0591e33..428230b 100644
--- a/t/koral/result/snippet.t
+++ b/t/koral/result/snippet.t
@@ -61,23 +61,44 @@
ok($snippet->stream($stream));
-is($snippet->inflate($index->dict)->to_string, 'snippet:Der [alte {4:Mann} ging] über die Straße');
+ok($snippet->inflate($index->dict), 'Inflate');
-is($snippet->char_substr(0),
+# This will, behind the scenes, initialize the primary string and create annotation positions
+is($snippet->char_string,
'Der alte Mann ging über die Straße',
'Get substring');
+is($snippet->inflate($index->dict)->to_string, 'snippet:Der [alte {4:Mann} ging] über die Straße');
+
+diag 'Test new character based snippet system';
+
+
+done_testing;
+__END__
+
+
+
+
+
+
+
+
$highlight = Krawfish::Koral::Result::Enrich::Snippet::Highlight->new(
start => 2,
end => 4,
number => 5
);
+
ok($snippet->add($highlight), 'Add highlight');
is($snippet->inflate($index->dict)->to_string,
'snippet:Der [alte {5:{4:Mann} ging}] über die Straße');
+
+
+
+
$highlight = Krawfish::Koral::Result::Enrich::Snippet::Highlight->new(
start => 2,
start_char => -1,