[wp-hackers] Page searching examples [was: 2.4
dougal at gunters.org
Wed Oct 3 19:59:36 GMT 2007
> I'll say it very clearly: I think that the search function should not
> search Pages *indiscriminately*. Why? Because Pages, in the context of
> most uses of WordPress I've seen, are rarely data. They most often
> consist of special setups, special Page Templates, forms, PHP, other
> stuff that is *not normal paragraph-like text*. That's why I don't
> want search looking at those, because it's not something that has
> anything that should be returned to the user in a search.
I'll grant you the 'indiscriminately' clause, inasmuch as I think that
the search behavior should be pluggable.
However, my observations of sites in the wild disagree with yours,
probably just because we pay attention to different sorts of sites.
Using my own site as an example, I have six pages. Two of those are the
"special setup" types of pages that you mention (Archives and Contact).
The other four are pages of textual content.
But even in the case of "special pages", including them in the search
isn't going to hurt anything, because it's extremely unlikely that they
would match any normal searches. The Archives page is just a placeholder
to map to the template, and has no content at all. The only way a search
would match it would be when matching against the page title. And a
search for "archives" matching against the Archives page seems pretty
natural to me.
In my case, the Contact page also contains some text, along with the
form from a plugin. But for the sake of example, let's say that the only
text in the page was the "[CONTACT-FORM]" placeholder needed by the
plugin. Again, a search for "contact" or "contact form" would match this
page (against either the title or the content) in a manner that seems
pretty normal and useful.
So, even for an edge case where a site has many pages driven by page
templates (and thus have no "normal" content in the database), including
pages in searches is most often going to be a Good Thing.
Perhaps you were conceiving something more complex, where the search
would be including the *results* of an Archive template, and not just
the raw database content for the page? I don't think anybody was
suggesting that, though.
Dougal Campbell <dougal at gunters.org <mailto:dougal at gunters.org>>
More information about the wp-hackers