Ticket #157: patch1

File patch1, 1.7 KB (added by Richard Boulton, 18 years ago)

Patch adding relevant tests to queryparsertest

Line 
1Index: queryparsertest.cc
2===================================================================
3--- queryparsertest.cc (revision 8676)
4+++ queryparsertest.cc (working copy)
5@@ -532,6 +532,22 @@
6 { "- NEAR 12V voeding", "(near:(pos=1) OR 12v:(pos=2) OR Zvoed:(pos=3))" },
7 { "waarom \"~\" in directorynaam", "(Zwaarom:(pos=1) OR Zin:(pos=2) OR Zdirectorynaam:(pos=3))" },
8 { "cd'r NEAR toebehoren", "(cd'r:(pos=1) NEAR 11 toebehoren:(pos=2))" },
9+ { "site:1 site:2", "(H1 OR H2)" },
10+ { "site:1 site2:2", "(H1 AND J2)" },
11+ { "site:1 site:2 site2:2", "((H1 OR H2) AND J2)" },
12+ { "site:1 OR site:2", "(H1 OR H2)" },
13+ { "site:1 AND site:2", "(H1 AND H2)" },
14+ { "A site:1 site:2", "(a FILTER (H1 OR H2))" },
15+ { "A (site:1 OR site:2)", "(a FILTER (H1 OR H2))" },
16+ { "A (site:1 OR site:2)", "(a FILTER (H1 OR H2))" },
17+ { "A site:1 site2:2", "(a FILTER (H1 AND J2))" },
18+ { "A site:1 site:2 site2:2", "(a FILTER ((H1 OR H2) AND J2))" },
19+ { "A site:1 OR site:2", "(a FILTER (H1 OR H2))" },
20+ { "A site:1 AND site:2", "(a FILTER (H1 AND H2))" },
21+ { "site:xapian.org OR site:www.xapian.org", "(xapian.org OR Hwww.xapian.org)" },
22+ { "site:xapian.org site:www.xapian.org", "(xapian.org OR Hwww.xapian.org)" },
23+ { "site:xapian.org AND site:www.xapian.org", "(xapian.org OR Hwww.xapian.org)" },
24+ { "Xapian site:xapian.org site:www.xapian.org", "xapian FILTER (Hxapian.org OR Hwww.xapian.org)" },
25 { NULL, NULL }
26 };
27
28@@ -576,6 +592,7 @@
29 queryparser.add_prefix("title", "XT");
30 queryparser.add_prefix("subject", "XT");
31 queryparser.add_boolean_prefix("site", "H");
32+ queryparser.add_boolean_prefix("site2", "J");
33 for (test *p = test_or_queries; p->query; ++p) {
34 string expect, parsed;
35 if (p->expect)