How to make Concrete5's Search/Search Indexing Work
Overview
Concrete5's search is made up of two main systems, The search block provides the users search box and the search indexer which indexes the content of the local site. Here's some common pitfalls using the search functionality and how to resolve them.
Search results mess up the layout
When you add a search block to a page, the default behavior is to return the results on the same page as the search box, this typically results in your search results displaying in a sidebar, header or some other place they really shouldn't show up.

The best way to set this up, is to create a page (add page), I'll call mine Search Results. In the main area of that page, add a new search block with the default options, then exit edit mode and publish your changes. Go back to any other search blocks you have on your site and select the "post to another page elsewhere" option and enter the path of your new search results page.

Now searching from your search blocks will now post to your own dedicated search results page and display results in the Main Area.

Search results only return results from some pages and some content.
By default Concrete5 only indexes areas named: 'Main Content' and 'Main', on a default install of concrete5 this will be where all your actual content is, but on a customized site with custom page types, you may have other areas you'd like to be searched. To configure this you'll have to get into the code just a little bit.
Override the index_search.php job file by copying it from [site root]/concrete/jobs/index_search.php to [site root]/jobs/index_search.php
Then open up the file in the editor of your choice and modify the run() function. In the code below I'm making the indexer index the content from two additional areas "Custom Area 1" and "Custom Area 2"
public function run() {
Loader::model('attribute/categories/collection');
Loader::model('attribute/categories/file');
Loader::model('attribute/categories/user');
Cache::disableLocalCache();
$attributes = CollectionAttributeKey::getList();
$attributes = array_merge($attributes, FileAttributeKey::getList());
$attributes = array_merge($attributes, UserAttributeKey::getList());
foreach($attributes as $ak) {
$ak->updateSearchIndex();
}
Loader::library('database_indexed_search');
$is = new IndexedSearch();
// Add These Lines
$is->addSearchableArea('Custom Area 1');
$is->addSearchableArea('Custom Area 2');
$result = $is->reindexAll();
return t('%s page(s) indexed.', $result->count);
}
}
save your changes, then go to the Dashboard -> Maintenance section and re-run your search indexer.
If you've added any custom blocks and the content from those blocks are not showing up in your search results the problem is most likely that the block developer did not include the "getSearchableContent()" function in the block's controller. This function should returns trimmed down text content for a given block. Below is the getSearchableContent function from the core content block's controller:
public function getSearchableContent() {
return $this->content;
}
Including Page Attributes in search results
You can include page attributes in your search results by modifying the attribute type in: Dashboard -> Pages and Themes -> Page Types -> Attributes
