ACQ unified search too limiting

Bug #1031535 reported by Bill Erickson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
2.3
Fix Released
Undecided
Unassigned
2.4
Fix Released
Undecided
Unassigned

Bug Description

Seen in Evergreen master/2.3

For example, search for lineitems with a single filter on Invoice -> ID. The results set only includes lineitems that are linked to other invoices. It excludes lineitems that are un-invoiced.

With Lebbeous' assistance, we tracked the culprits down to 1) an INNER JOIN on acqmapinv instead of a LEFT JOIN and, related, a WHERE clause test that looks for NOT (invoice.id = X), which should be changed to (invoice.id != X OR invoice.id IS NULL) to include lineitems that have no invoice linkage.

Code to follow soon.

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

I think one thing that's missing from the above explanation is that the kind of search that has a problem is, "show me lineitems where invoice id is NOT 3."

Here's a patch that works for me, but wants a little more testing so we can be reasonably sure that it doesn't cause any regressions for other queries:

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

tags: added: pullrequest
Changed in evergreen:
milestone: none → 2.4.0-alpha
Revision history for this message
Jennifer Pringle (jpringle-u) wrote :

I have discovered odd behaviour in the invoice search in 2.3.0 that I think may be related to this bug.

In the invoice search interface if you do the search "PO-State is on-order" with the check boxes for "Sort by title" and "Limit to Invoiceable Items" unchecked you get no results. If you check the boxes for either "Sort by title" and "Limit to Invoiceable Items" then you get results.

I see very similar behaviour when I perform the search "SL-Org Unit is YCL-RH". When "Sort by title" and "Limit to Invoiceable Items" are unchecked very different results are returned than if either box is checked.

It makes sense that "Limit to Invoiceable Items" would change the results, but I expect to get the same results (just in a different order) whether "Sort by title" is checked or unchecked.

Revision history for this message
Bill Erickson (berick) wrote :

I can confirm that with Lebbeous' patch a search on "invoice id does not equal" now returns un-invoiced items as well as invoiced items, whereas before it would only return invoiced items.

Revision history for this message
Bill Erickson (berick) wrote :

Jennifer, just to be clear, the search only displays the first 10 results. You have to use the page navigation links along the top to see other pages of results. If you missed the links (which don't stand out), it might appear that you are getting different results when they are really just sorted to a different page. (If you are using the links, please disregard :)

Changed in evergreen:
status: New → Confirmed
Revision history for this message
Bill Erickson (berick) wrote :

Jennifer, can you confirm if the issue you reported was a result of paging or if the search was in fact returning different results when sorting by title (taking all pages of results into account)?

Revision history for this message
Jason Stephenson (jstephenson) wrote :

Setting to incomplete as we await Jennifer's response.

Changed in evergreen:
status: Confirmed → Incomplete
Ben Shum (bshum)
Changed in evergreen:
milestone: 2.4.0-alpha1 → 2.4.0-beta
Ben Shum (bshum)
Changed in evergreen:
milestone: 2.4.0-beta → 2.4.0-rc
Ben Shum (bshum)
Changed in evergreen:
milestone: 2.4.0-rc → none
Revision history for this message
Mike Rylander (mrylander) wrote :

Since we've been waiting over 7 months, I'm going to un-Incomplete this, Triage-ify it, and ask for more eyeballs. Let's clean up ACQ! :)

Changed in evergreen:
milestone: none → 2.5.0-alpha1
status: Incomplete → Triaged
importance: Undecided → Medium
Remington Steed (rjs7)
Changed in evergreen:
milestone: 2.5.0-alpha1 → 2.5.0-alpha2
Dan Wells (dbw2)
Changed in evergreen:
assignee: nobody → Dan Wells (dbw2)
Revision history for this message
Dan Wells (dbw2) wrote :

Worked for me in testing, and the code (while pretty dense overall) eventually made sense to me. Since a LEFT JOIN is effectively the same as an INNER JOIN if we have a non-null WHERE condition on the table being joined anyway, I couldn't think of a case where changing to a LEFT JOIN would actually hurt this interface.

Pushed to master, rel_2_4, and rel_2_3. Thanks, all!

Changed in evergreen:
assignee: Dan Wells (dbw2) → nobody
status: Triaged → Fix Committed
Ben Shum (bshum)
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.