@@ -380,8 +380,7 @@ public void testTwoConjuncts () throws JsonProcessingException, IOException {
380380 .asText ());
381381 assertEquals ("pubDate" , res .at ("/collection/operands/1/key" ).asText ());
382382 assertEquals ("2014" , res .at ("/collection/operands/1/value" ).asText ());
383- assertTrue (res .at ("/collection/operands/1/type" )
384- .isMissingNode ());
383+ assertEquals ("type:integer" , res .at ("/collection/operands/1/type" ).asText ());
385384 assertEquals ("match:eq" , res .at ("/collection/operands/1/match" )
386385 .asText ());
387386 assertTrue (res .at ("/warnings/0" ).isMissingNode ());
@@ -671,6 +670,80 @@ public void testMixed () throws JsonProcessingException, IOException {
671670 }
672671
673672
673+ @ Test
674+ public void testIntegerConstraints () throws IOException {
675+ collection = "nTok != 200" ;
676+ qs .setQuery (query , ql );
677+ qs .setCollection (collection );
678+ res = mapper .readTree (qs .toJSON ());
679+ assertEquals ("koral:doc" , res .at ("/collection/@type" ).asText ());
680+ assertEquals ("nTok" , res .at ("/collection/key" ).asText ());
681+ assertEquals ("200" , res .at ("/collection/value" ).asText ());
682+ assertEquals ("type:integer" , res .at ("/collection/type" ).asText ());
683+ assertEquals ("match:ne" , res .at ("/collection/match" ).asText ());
684+
685+
686+ collection = "nTok > 200" ;
687+ qs .setQuery (query , ql );
688+ qs .setCollection (collection );
689+ res = mapper .readTree (qs .toJSON ());
690+ assertEquals ("koral:doc" , res .at ("/collection/@type" ).asText ());
691+ assertEquals ("nTok" , res .at ("/collection/key" ).asText ());
692+ assertEquals ("200" , res .at ("/collection/value" ).asText ());
693+ assertEquals ("type:integer" , res .at ("/collection/type" ).asText ());
694+ assertEquals ("match:gt" , res .at ("/collection/match" ).asText ());
695+
696+ collection = "nTok != 2000" ;
697+ qs .setQuery (query , ql );
698+ qs .setCollection (collection );
699+ res = mapper .readTree (qs .toJSON ());
700+ assertEquals ("koral:doc" , res .at ("/collection/@type" ).asText ());
701+ assertEquals ("nTok" , res .at ("/collection/key" ).asText ());
702+ assertEquals ("2000" , res .at ("/collection/value" ).asText ());
703+ assertEquals ("type:integer" , res .at ("/collection/type" ).asText ());
704+ assertEquals ("match:ne" , res .at ("/collection/match" ).asText ());
705+
706+ collection = "nTok < 2000" ;
707+ qs .setQuery (query , ql );
708+ qs .setCollection (collection );
709+ res = mapper .readTree (qs .toJSON ());
710+ assertEquals ("koral:doc" , res .at ("/collection/@type" ).asText ());
711+ assertEquals ("nTok" , res .at ("/collection/key" ).asText ());
712+ assertEquals ("2000" , res .at ("/collection/value" ).asText ());
713+ assertEquals ("type:integer" , res .at ("/collection/type" ).asText ());
714+ assertEquals ("match:lt" , res .at ("/collection/match" ).asText ());
715+
716+ collection = "nTok = 2000" ;
717+ qs .setQuery (query , ql );
718+ qs .setCollection (collection );
719+ res = mapper .readTree (qs .toJSON ());
720+ assertEquals ("koral:doc" , res .at ("/collection/@type" ).asText ());
721+ assertEquals ("nTok" , res .at ("/collection/key" ).asText ());
722+ assertEquals ("2000" , res .at ("/collection/value" ).asText ());
723+ assertEquals ("type:integer" , res .at ("/collection/type" ).asText ());
724+ assertEquals ("match:eq" , res .at ("/collection/match" ).asText ());
725+
726+ collection = "nTok >= 2000" ;
727+ qs .setQuery (query , ql );
728+ qs .setCollection (collection );
729+ res = mapper .readTree (qs .toJSON ());
730+ assertEquals ("koral:doc" , res .at ("/collection/@type" ).asText ());
731+ assertEquals ("nTok" , res .at ("/collection/key" ).asText ());
732+ assertEquals ("2000" , res .at ("/collection/value" ).asText ());
733+ assertEquals ("type:integer" , res .at ("/collection/type" ).asText ());
734+ assertEquals ("match:geq" , res .at ("/collection/match" ).asText ());
735+
736+ collection = "nTok <= 2000" ;
737+ qs .setQuery (query , ql );
738+ qs .setCollection (collection );
739+ res = mapper .readTree (qs .toJSON ());
740+ assertEquals ("koral:doc" , res .at ("/collection/@type" ).asText ());
741+ assertEquals ("nTok" , res .at ("/collection/key" ).asText ());
742+ assertEquals ("2000" , res .at ("/collection/value" ).asText ());
743+ assertEquals ("type:integer" , res .at ("/collection/type" ).asText ());
744+ assertEquals ("match:leq" , res .at ("/collection/match" ).asText ());
745+ }
746+
674747 @ Test
675748 public void testDateYear () throws JsonProcessingException , IOException {
676749 collection = "pubDate in 2000" ;
@@ -690,7 +763,7 @@ public void testDateYear () throws JsonProcessingException, IOException {
690763 assertEquals ("koral:doc" , res .at ("/collection/@type" ).asText ());
691764 assertEquals ("pubDate" , res .at ("/collection/key" ).asText ());
692765 assertEquals ("2000" , res .at ("/collection/value" ).asText ());
693- assertTrue ( res .at ("/collection/type" ).isMissingNode ());
766+ assertEquals ( "type:integer" , res .at ("/collection/type" ).asText ());
694767 assertEquals ("match:eq" , res .at ("/collection/match" ).asText ());
695768
696769 collection = "pubDate since 2000" ;
0 commit comments