@@ -247,6 +247,11 @@ public void setUp() throws Exception {
247
247
assertU (adoc ("id" , "150" , "bibcode" , "xxxxxxxxxx150" , "title" , "nag5-abcd" ));
248
248
assertU (adoc ("id" , "151" , "bibcode" , "xxxxxxxxxx151" , "title" , "nag5abcd" ));
249
249
assertU (adoc ("id" , "152" , "bibcode" , "xxxxxxxxxx152" , "title" , "nag5 abcd" ));
250
+ assertU (adoc ("id" , "153" , "bibcode" , "xxxxxxxxxx153" , "title" , "NGC 1" ));
251
+ assertU (adoc ("id" , "154" , "bibcode" , "xxxxxxxxxx154" , "title" , "NGC-1" ));
252
+ assertU (adoc ("id" , "155" , "bibcode" , "xxxxxxxxxx155" , "title" , "N-1" ));
253
+ assertU (adoc ("id" , "156" , "bibcode" , "xxxxxxxxxx156" , "title" , "N 1" ));
254
+ assertU (adoc ("id" , "157" , "bibcode" , "xxxxxxxxxx157" , "title" , "NGC1" ));
250
255
251
256
assertU (adoc ("id" , "318" , "bibcode" , "xxxxxxxxxx318" , "title" , "creation of a thesaurus" , "pub" , "creation of a thesaurus" ));
252
257
assertU (adoc ("id" , "382" , "bibcode" , "xxxxxxxxxx382" , "title" , "xhtml <tags> should be <SUB>fooxx</SUB> <xremoved>" ));
@@ -970,7 +975,96 @@ public void testSynonyms() throws Exception {
970
975
}
971
976
972
977
public void testOtherCases () throws Exception {
978
+
979
+ // change to NGC tokenizer in the schema; we want to index both
980
+ // variants, but during search time only query for the concat version
981
+
982
+ assertQ (req ("q" , "title" + ":NGC" ),
983
+ "//*[@numFound='4']" ,
984
+ "//doc/str[@name='id'][.='153']" , //NGC 1
985
+ "//doc/str[@name='id'][.='154']" , //NGC-1
986
+ "//doc/str[@name='id'][.='155']" , //N-1
987
+ "//doc/str[@name='id'][.='156']" //N 1
988
+ //"//doc/str[@name='id'][.='157']" //NGC1
989
+ );
990
+
991
+ assertQueryEquals (req ("q" , "title:\" NGC 1\" " , "defType" , "aqp" ),
992
+ "title:acr::ngc1" ,
993
+ TermQuery .class );
994
+ assertQ (req ("q" , "title" + ":NGC 1" , "indent" , "true" ),
995
+ "//*[@numFound='5']" ,
996
+ "//doc/str[@name='id'][.='153']" ,
997
+ "//doc/str[@name='id'][.='154']" ,
998
+ "//doc/str[@name='id'][.='155']" ,
999
+ "//doc/str[@name='id'][.='156']" ,
1000
+ "//doc/str[@name='id'][.='157']"
1001
+ );
1002
+
1003
+
1004
+ assertQueryEquals (req ("q" , "title:\" NGC-1\" " , "defType" , "aqp" ),
1005
+ "title:acr::ngc1" ,
1006
+ TermQuery .class );
1007
+ assertQ (req ("q" , "title" + ":NGC-1" ),
1008
+ "//*[@numFound='5']" ,
1009
+ "//doc/str[@name='id'][.='153']" ,
1010
+ "//doc/str[@name='id'][.='154']" ,
1011
+ "//doc/str[@name='id'][.='155']" ,
1012
+ "//doc/str[@name='id'][.='156']" ,
1013
+ "//doc/str[@name='id'][.='157']" //NGC1
1014
+ );
1015
+
1016
+ assertQueryEquals (req ("q" , "title:\" N-1\" " , "defType" , "aqp" ),
1017
+ "title:n1" ,
1018
+ TermQuery .class );
1019
+ assertQ (req ("q" , "title" + ":N-1" ),
1020
+ "//*[@numFound='2']" ,
1021
+ "//doc/str[@name='id'][.!='153']" ,
1022
+ "//doc/str[@name='id'][.!='154']" ,
1023
+ "//doc/str[@name='id'][.='155']" ,
1024
+ "//doc/str[@name='id'][.='156']" ,
1025
+ "//doc/str[@name='id'][.!='157']"
1026
+ );
1027
+
1028
+ // this finds 0 because during indexing, we'd turn the two
1029
+ // tokens into 'n1' - and this search
1030
+ assertQueryEquals (req ("q" , "title:\" N 1\" " , "defType" , "aqp" ),
1031
+ "title:n1" ,
1032
+ TermQuery .class );
1033
+ assertQ (req ("q" , "title" + ":\" N 1\" " ),
1034
+ "//*[@numFound='2']" ,
1035
+ "//doc/str[@name='id'][.!='153']" ,
1036
+ "//doc/str[@name='id'][.!='154']" ,
1037
+ "//doc/str[@name='id'][.='155']" ,
1038
+ "//doc/str[@name='id'][.='156']" ,
1039
+ "//doc/str[@name='id'][.!='157']" //NGC1
1040
+ );
1041
+
1042
+ assertQueryEquals (req ("q" , "title:\" NGC1\" " , "defType" , "aqp" ),
1043
+ "title:acr::ngc1" ,
1044
+ TermQuery .class );
1045
+ assertQ (req ("q" , "title" + ":NGC1" ),
1046
+ "//*[@numFound='5']" ,
1047
+ "//doc/str[@name='id'][.='153']" ,
1048
+ "//doc/str[@name='id'][.='154']" ,
1049
+ "//doc/str[@name='id'][.='155']" ,
1050
+ "//doc/str[@name='id'][.='156']" ,
1051
+ "//doc/str[@name='id'][.='157']"
1052
+ );
973
1053
1054
+ assertQueryEquals (req ("q" , "=title:\" NGC 1\" " , "defType" , "aqp" ),
1055
+ "title:\" acr::ngc 1\" " ,
1056
+ PhraseQuery .class );
1057
+ assertQ (req ("q" , "=title" + ":NGC 1" ),
1058
+ "//*[@numFound='4']" ,
1059
+ "//doc/str[@name='id'][.='153']" ,
1060
+ "//doc/str[@name='id'][.='154']" ,
1061
+ "//doc/str[@name='id'][.='155']" ,
1062
+ "//doc/str[@name='id'][.='156']" ,
1063
+ "//doc/str[@name='id'][.!='157']"
1064
+ );
1065
+
1066
+
1067
+
974
1068
// #147 - parsing of WDDF tokens
975
1069
// analyzer operation. eg. XXX-YYYY => (XXX AND YYY) OR XXXYYY
976
1070
assertQueryEquals (req ("q" , "NAG5-ABCD" , "defType" , "aqp" ),
0 commit comments