Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 11988)
+++ wp-includes/post.php	(working copy)
@@ -7,7 +7,22 @@
  * @since 1.5.0
  */
 
+//
+// Post Type Registration
+//
+
 /**
+ * Creates the initial post types when 'init' action is fired.
+ */
+function create_initial_post_types() {
+	register_post_type( 'post', array('exclude_from_search' => false) );
+	register_post_type( 'page', array('exclude_from_search' => false) );
+	register_post_type( 'attachment', array('exclude_from_search' => false) );
+	register_post_type( 'revision', array('exclude_from_search' => true) );
+}
+add_action( 'init', 'create_initial_post_types', 0 ); // highest priority
+
+/**
  * Retrieve attached file path based on attachment ID.
  *
  * You can optionally send it through the 'get_attached_file' filter, but by
@@ -408,6 +423,40 @@
 }
 
 /**
+ * Register a post type. Do not use before init.
+ *
+ * A simple function for creating or modifying a post type based on the
+ * parameters given. The function will accept an array (second optional
+ * parameter), along with a string for the post type name.
+ *
+ *
+ * Optional $args contents:
+ *
+ * exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true.
+ * 
+ * @package WordPress
+ * @subpackage Post
+ * @since 2.9.0
+ * @uses $wp_post_types Inserts new post type object into the list
+ *
+ * @param string $post_type Name of the post type.
+ * @param array|string $args See above description.
+ */
+function register_post_type($post_type, $args = array()) {
+	global $wp_post_types;
+
+	if (!is_array($wp_post_types))
+		$wp_post_types = array();
+
+	$defaults = array('exclude_from_search' => true);
+	$args = wp_parse_args($args, $defaults);
+
+	$post_type = sanitize_user($post_type, true);
+	$args['name'] = $post_type;
+	$wp_post_types[$post_type] = (object) $args;
+}
+
+/**
  * Updates the post type for the post ID.
  *
  * The page or post cache will be cleaned for the post ID.
Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 11988)
+++ wp-includes/query.php	(working copy)
@@ -2072,8 +2072,14 @@
 
 		$post_type_cap = $post_type;
 
+		global $wp_post_types;
+		$exclude_post_types = '';
+		foreach ( $wp_post_types as $_wp_post_type ) {
+			if ( $_wp_post_type->exclude_from_search )
+				$exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $_wp_post_type->name);
+		}
 		if ( 'any' == $post_type ) {
-			$where .= " AND $wpdb->posts.post_type != 'revision'";
+			$where .= $exclude_post_types;
 		} elseif ( ! empty( $post_type ) ) {
 			$where .= " AND $wpdb->posts.post_type = '$post_type'";
 		} elseif ( $this->is_attachment ) {
