Search through comments activated Nov04 '05

I just implemented a much better search mechanism, for this site, which searches through blog posts and feedback. Before, you could only search through posts.

This struck me as an important, after seeing Josh leave some very detailed, precise, and valuable feedback. (Let it be known, that wasn’t his first time, for doing so.) The point is... everyone who leaves feedback is adding value to this humble blog - and I’d like it to be just as important as my own content.

Therefore, it’s now searchable.

The best part is - you, the user, don’t have to do anything! You can continue searching through the regular search box, or via the URL. The results will be pooled together, based on relevancy, and presented as one group.

For example, based on a recent thread with Jennifer, try searching for using commas. This should be a good example of how the results are grouped together.

How it’s done

Talking to Dale, a while back (who implemented something similar - months ago), I mentioned how I’d like to do the same thing for my blog, but I didn’t know how to search two separate database tables, at once.

Well... thanks to arrays, I’ve figured out an easy solution.

I still have to write two separate queries (for two separate tables), but by plugging all the results into a single PHP array, I am able to sort everything as a group (based on relevancy), and spit out each array item into an HTML table, like I had before.

So... there is not a single, noticable difference with how my results appear.

And that’s the only way I expected this to happen.

Categories: PHP , Search , Web Development

Add Feedback (view all)

Leave feedback

Feedback

Input format: The editor controls below will assist with Markdown syntax.

Status

Sub-status

Your info

Good work - it's definitely useful functionality, isn't it? :) ... Read more.

You bet it's useful - thanks to associative arrays, and PHP's krsort! ... Read more.

Great stuff, if I get time I shall upgrade my seach to be as good as yours! ... Read more.

Hehe, yes, and I'd upgrade WordPress' search to be as good as yours if... it wasn't such an enormous piece of software and that I'd never get it me ... Read more.

Josh - yes, the results are sorted by relevance, which comes from the query. So, I have two separate queries - one that se ... Read more.

matthom is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from Chicago. Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.

Contact Matt

Similar Entries

Stats

2 unique visits since August 2008

Syndicate

Advertisements