Welcome Guest, Not a member yet? Register   Sign In
Can anyone explain how this usort actually works
#8

I found usort on that very list :-)

I had never used it before and it worked magically. My intention is to make the weighting function more complex over time, but strpos of the search string will do for now.

Currently I am searching projects, cases, companies, tasks, trackers, people, guides and call tables, amalgamating the results into a search results array that has name, link, icon, description and weight indexes for each sub array constructed from the various bits of info in the different tables.

At the moment I am just taking the first 10 results of each table, which is missing relevant info for now, but given the speed of usort I am experimenting with taking the first 100 results and then all results of each table, sorting it, and then cutting it down to size for the page. However I suspect it will get too slow but at the moment the function is so fast that performance seems unaffected.

However, as I said, it is what I am doing right now. I just feel so much better now I actually have some understanding of how usort is actually working.

Apparently the root of this sorting method was invented in the 60's. So many clever people, it constantly amazes me.

Best wishes,

Paul.
Reply


Messages In This Thread
RE: Can anyone explain how this usort actually works - by PaulD - 09-28-2015, 05:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB