Enforce prefix on all dictionary entries
Change-Id: I0060de59503b2e4d3be95faa209c5e87a02dccb7
diff --git a/t/koral/doc.t b/t/koral/doc.t
index b13fb9b..a43c14a 100644
--- a/t/koral/doc.t
+++ b/t/koral/doc.t
@@ -24,7 +24,7 @@
# );
is(substr($doc->stream->to_string, 0, 40),
- q!(0)<>['Der';'Der'$1](1)< >['alte';'alte'!,
+ q!(0)<>['Der';'! . TOKEN_PREF . q!Der'$1](1)< >['alte';'! . TOKEN_PREF . q!alt!,
'Get stream');
is($doc->fields->to_string,
@@ -43,7 +43,7 @@
# );
is(substr($doc->stream->to_string, 0, 100),
- q!(0)<>['Der';'akron=Der'$1;'! .SPAN_PREF. q!akron/c=NP'$3](1)< >['Bau';'akron=Bau-Leiter'$3](2)<->['Leiter'](3)< >['!,
+ q!(0)<>['Der';'! . TOKEN_PREF . q!akron=Der'$1;'! .SPAN_PREF. q!akron/c=NP'$3](1)< >['Bau';'! . TOKEN_PREF . q!akron=Bau-Leiter'$3](2)<->['Leiter'](3)< >!,
'Get stream');
diff --git a/t/koral/inflate.t b/t/koral/inflate.t
index 1f8c2f2..b7a30cc 100644
--- a/t/koral/inflate.t
+++ b/t/koral/inflate.t
@@ -13,6 +13,7 @@
ok(my $qb = Krawfish::Koral::Query::Builder->new, 'Create Builder');
ok(my $q = $qb->term_re('[ac].'), 'Regex');
ok($q = $q->normalize->finalize, 'Prepare query');
+
is($q->to_string, "/[ac]./", 'Stringification');
ok($q = $q->identify($index->dict), 'Prepare query');
is($q->to_string, '(#10)|(#12)|(#2)|(#8)', 'Stringification');
@@ -20,7 +21,6 @@
ok($q = $q->optimize($index->segment), 'Prepare query');
is($q->to_string, "or(or(or(#10,#12),#8),#2)", 'Stringification');
-
# Class
ok($q = $qb->class(
$qb->term_re('[ac].'),
@@ -50,9 +50,15 @@
$qb->term('aa'),
$qb->term('bb')
), 'Regex in constraint');
-ok($q = $q->normalize->finalize->identify($index->dict), 'Prepare query');
+
+ok($q = $q->normalize->finalize, 'Prepare query');
+is($q->to_string, "constr(pos=precedes,between=1-1,notBetween=/[ac]./:aa,bb)",
+ 'Stringification');
+
+ok($q = $q->identify($index->dict), 'Prepare query');
is($q->to_string, "constr(pos=precedes,between=1-1,notBetween=(#10)|(#12)|(#2)|(#8):#2,#4)",
'Stringification');
+
ok($q = $q->optimize($index->segment), 'Prepare query');
is($q->to_string, "constr(pos=1,between=1-1,notBetween=or(or(or(#10,#12),#8),#2):#2,#4)",
'Stringification');