QueryParser "explain" (abstract query object) functionality
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Evergreen |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Before QueryParser we would return a hash that contained nearly all of the information needed to reconstruct a search UI. This was mostly in the form of a hash with keys for each search class and the compiled per-class search terms.
But, then came QP, and while most things were much better (defined grammar, full boolean support, nesting, extensible filters and modifiers, etc), they were much more complicated. Too complicated to send back the same simple explanation of the query for the client to use in UI building.
All that is changed now! [Thanks primarily to Lebbeous Fogle-Weekley and a little bit me.]
When you perform a search, you now also get back an abstract representation of your search query. fts-replacement.pl is a test script that shows you things that QueryParser does, including the new abstract query feature, and it also reconstitutes a string from the abstract query to demonstrate the correctness of that query.
The uses for this are myriad: test harnesses for QP features, auto-building UIs (within TPAC or entirely new ones), storing and processing normalized searches, search structure manipulation (splitting, splicing, grafting), and many other clever things!
Here lives a rebased, pull-ready branch for your enjoyment and eventual merging:
http://
Changed in evergreen: | |
milestone: | none → 2.3.0-alpha |
Changed in evergreen: | |
status: | Fix Committed → Fix Released |
Looks very cool! A few minor comments, take them for what they're worth:
Any interest in squashing this down a bit further? git logs with "Two changes:" as the summary line show that you guys were iterating back and forth, which is cool to see, but probably not necessary for final master.
Also, it's a bit weird to see "use lib '/home/ opensrf/ svn/OpenSRF/ trunk/src/ perl/lib/ ';" in fts-replacement.pl; it probably won't cause problems for anyone in practice, but looks a bit rough.