WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 5 years ago

#5149 closed enhancement (duplicate)

Search everything (or almost everything)

Reported by: ryan Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.3
Component: General Keywords: search
Focuses: Cc:

Description

Extend search to include pages and other things. The more comprehensive the better, limited only by performance considerations. Care will need to be taken when including pages in the search results since themes that display full post content may break. Putting a filter that strips tags from page content returned in search results would suffice. The search should be as hookable as possible to allow customization via plugin.

Possible things to search on:

  • Post title, content, excerpt, author, tags, categories
  • Page title, content, excerpt, author, tags, categories
  • Comment content, author
  • Post/page meta fields

Features that would be nice to have:

  • Order search by relevance
  • Excerpt relevant areas of content, search engine style

Relevant discussions:

Attachments (1)

search_pages.diff (1.8 KB) - added by ryan 7 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 westi7 years ago

Should we not introduce a new search loop with search result specific template tags and then the related in memory storage of search results is just a collection of objects|arrays that each represent a search result.

These could have the following properties (all exposed as new template tags):

  • Content / Excerpt
  • Title
  • Type of content: Post|Page|Comment etc.
  • ...

For Backward compatibility a normal post_loop on a search results page would only display posts.

comment:2 ryan7 years ago

We'd have to run two searches then, which seems a waste. I'd like to keep it at one search query.

As for comments, should we directly include them in the search results or just the posts they are associated with?

Anyhow, here's a quick patch that extends search to pages. There's no backward-compat filtering done on them yet.

ryan7 years ago

comment:3 ryan6 years ago

(In [6467]) Throw pages into search queries. Let's see how they handle. see #5149

comment:4 DD326 years ago

Also: #1435 - Pages should be searched: "Include 'static' pages in search results"

comment:5 ffemtcj6 years ago

  • Milestone changed from 2.5 to 2.6

comment:6 Denis-de-Bernardy5 years ago

  • Milestone 2.9 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

see #9785

Note: See TracTickets for help on using tickets.