QueryParser "explain" (abstract query object) functionality

Bug #942748 reported by Mike Rylander
6
This bug affects 1 person
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://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/senator/qp-latest

Tags: pullrequest
Revision history for this message
Dan Scott (denials) wrote :

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.

Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

Hey Dan,

Thanks for looking at this. I don't why I let this fall off my radar.

Here's a version that's squashed, rebased to current master, and gets rid of those vestigial 'use lib' lines that you found.

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/senator/qp-now

Thanks!

Revision history for this message
Dan Scott (denials) wrote :

I love this, if only for the ability to quickly generate the raw SQL for a given query (that we can then EXPLAIN ANALYZE and tweak further in QueryParser). Per IRC on 2012-05-21, Lebbeous and I have squashed a few bugs, and I've signed off on Lebbeous's commits and pushed my own fixes to user/dbs/query_parser_fts_replacement (including making QueryParser no longer use tabs for the SQL it generates).

Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

Thanks much Dan! In master.

Changed in evergreen:
status: New → Fix Committed
Bill Erickson (berick)
Changed in evergreen:
milestone: none → 2.3.0-alpha
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.