Acadia opened this issue on Apr 09, 2006 ยท 84 posts
williamsn posted Sun, 09 April 2006 at 2:43 PM
Quote - "Searching by user name will INCREASE the speed. Why? Since the user ID is a separate field in the posts table. A search function that first looks up the userID for a user name (fast search, only 300.000 or so records in that table) and then looks up the posts in the posts table by UserID (fast search, looking up by a integer numeric is very efficient) is much, much more efficient than a full text search over all the post contents. Especially when the userID field in the posts table is indexed. Anything that reduces the need for full text searches and "WHERE < string expression > LIKE < pattern >" will speed up the site. There's only one downside. By indexing more fields, updates and additions to the table will slow down. On the other hand, I expect that the number of database searches far exceeds the number of additions/updates/deletions, easily by a factor of 10,000 or more. Not a real problem. I'd love to see the "search by user name" functionality reinstated. In fact, I'd love to see as many "search by" options as possible, preferably with AND and OR clauses. That would both speed up the searches AND give the user the most relevant results."
You are only partially right here. We are not using "WHERE < string expression > LIKE < pattern >" searches any more. That's why the search is so much faster than it used to be, and how we fixed the bandwidth. There is a special index in subjects, bodies and links called a FULLTEXT index which is basically another file containing every single word in the database, how many times it's used, where it's used, and where it's most relevant. Then we perform a "MATCH (body,subject,link_title) AGAINST (< pattern >)" and it works much quicker and returns a numeric representation of how relevant that row is to what the user searched for. It also prevents someone from search for "rat" and getting "preparation" and "rational" as results ... he only gets "rat" as results. You are right, however, in that there is an index on the userID of each record in the database. Searching by username first finds the userID of that user by searching the member table (takes about a second) then returns every result in the threads/messages that matches that userID (takes about two-five seconds depending on how many posts that user has). It's very fast. Speed is not why we aren't allowing username searches (previous messages will explain that). I have some ideas that may allow us to bring back username searching. I'm presenting those to the people who make decisions and we'll see. NO promises. But of course the forum users are who are must important, because you're the people using these every day, so I'm going to do what I can.
-Nicholas