#131: Correct parentheses support in in search parsing
------------------------+---------------------------------------------------
Reporter: jblayloc | Owner: jblayloc
Type: defect | Status: assigned
Priority: critical | Milestone:
Component: WebSearch | Version:
Resolution: | Keywords: INSPIRE Invenio Syntax News
------------------------+---------------------------------------------------
Changes (by simko):
* status: in_merge => assigned
Comment:
1) Cosmetic comment: if we take Peter Norvig's code and chances are it
may be updated, we'd better not delete unnecessary stuff to ease later
updates. If chances are we won't need to update often, and if we
modify it substantially already now (even though mostly cosmetically),
then let us rename the file to `logicutils.py` so that it plays better
with the other utility libraries we have (`dateutils.py`,
`mailutils.py` and the like).
2) I started to look at `parse_query` API changes that this branch
introduces, like:
{{{
self.assertEqual(self.parser.parse_query('(expr1) - expr2 + (expr3) |
expr4'),
- ['+', 'expr1', '-', 'expr2', '+', 'expr3', '|', 'expr4'])
+ ['+', '+ expr1 | expr4', '+', '- expr2 | expr4', '+', '+ expr3 |
expr4'])
}}}
in order to check how would they influence the search engine behaviour
(since apparently the output could have been kept the same in this
particular case due to no nested parens). When doing so, I noticed a
few problems:
2a) try to query for:
{{{
(ellis -muon (|kaon))
}}}
you will get mismatched parens warning;
2b) try the following query:
{{{
(ellis )
}}}
which gets parsed as:
{{{
basic search units are: [['+', '(ellis', '', 'w'], ['+', ')', '', 'w']]
}}}
which is not correct;
2c) try queries like:
{{{
U(1)
U(1) -SL(2,Z)
(U(1) -SL(2,Z))
}}}
The last one fails. (Actually, you can just run
`python ./websearch_regression_tests.py --yes-i-know`, since we have
a test case for this `apparently nested' parens case that is not
really a nested parens case.)
Can you please have a look at those issues?
--
Ticket URL: <http://invenio-software.org/ticket/131#comment:10>
Invenio <http://invenio-software.org>