F104 - Failure Feedback Forum
There seems to be several problems with c4_View::Search. The comparison seems to be in wrong order, making the binary search divide across the wrong axis. Also the compare function compares against all properties in the view, failing if any are not present in the search criteria.
I have attached a patch with fixes and some performance improvements.
Best Regards, Alexander Stigsen
2006-Nov-05 14:29:43 by anonymous:
The patch also has several problems, primarily that it only works with basic views (eg. it has no way to know if the view could be reverse sorted). The original search function passed the regression test by luck. When sorting a view it seems that the property being sorted on always ends up as the first property in the resulting view. This made search end up with the correct result, even though the underlying compare sometimes gave incorrect results.
I have attached an patch to the regression test that exposes the bug. I hope that a better solution than my original patch can be found.
Imported
Copied from metakit cvstract ticket #11
<a title="File uploaded at Dec 09/2006 08:52PM" href="files/1841.patch"><img border=0 alt="Document Icon" src="styles/doc.gif">search.patch</a>
<a title="File uploaded at Dec 09/2006 08:52PM" href="files/2730.patch"><img border=0 alt="Document Icon" src="styles/doc.gif">searchtest.patch</a>