search index only indexing areas called 'Main content' or 'main' !!!!!!

Permalink 1 user found helpful
I have discovered that concrete5 only indexes areas named 'Main content' or 'main'. Any other area will not have their content indexed. You can see this code in /libraries/database_indexed_search.php and /libraries/indexed_search.php). This explains why search was basically not working on my site. If I add my area names to these core files then my content starts appearing in the pageSearchIndex table correctly.
There is a function in the class called addSearchableArea. So I guess I could use this - but it's hard to see where I would call it from and when.
This surely is a serious issue that will affect anybody who wants to have search on the site. Can anyone explain this? Is anyone else able to confirm this behaviour?

 
windchill replied on at Permalink Reply
I added the following to concrete/jobs/index_search.php:

$is->addSearchableArea('mainColumn');
$is->addSearchableArea('mainColumn1');
$is->addSearchableArea('mainColumn2');

Now my areas are indexed correctly.
Unfortunately this is still a hack in the core code.
Tony replied on at Permalink Reply
Tony
you don't have to hack into core. just copy your index_search.php file to the root/jobs directory to override it, then make your changes there.
Remo replied on at Permalink Reply
Remo
but wouldn't it be nice to have an interface to do this?

I reported this issue a few months ago and it seems that there are still a few people having the exact same problem.

Why not simply search within all the areas? Is the performance gain so big if you just search within a limited number of areas? You could even remove a join..
Tony replied on at Permalink Reply
Tony
...searching all the areas by default would make more sense.
BeKindRewind replied on at Permalink Reply
BeKindRewind
Hey windchill. Where in the index_search.php code do I place new add searchable area tags?

Thanks for finding this. It's been driving me crazy for a week.
windchill replied on at Permalink Reply
Here is an example (remember to put the file in your jobs folder outside the conxrete core). You can see the calls to $is->addSearchableArea in the run method.

<?php 
/**
*
* Responsible for loading the indexed search class and initiating the reindex command.
* @package Utilities
*/
defined('C5_EXECUTE') or die(_("Access Denied."));
class IndexSearch extends Job {
   public $jNotUninstallable=1;
   function getJobName() {
      return t("Index Search Engine");
   }
   function getJobDescription() {
      return t("Index the site to allow searching to work quickly and accurately.");
   }
lphillips replied on at Permalink Reply
lphillips
Hey Mr S

Just got here from a quick google of the same issue.

Just to let everyone know that this has changed in the latest version. (But i wouldn't really say fixed).

The code has been re-factored a bit and to get c5 to index a block named anything but 'Main Content' or 'Main', you must now add the Area name to an array.

The Array is inside concrete/libraries/database_indexed_search.php (Line: 119).
The var is $searchableAreaNames of IndexedSearch.
binoy replied on at Permalink Reply
binoy
I am using 'area splitter' package in my website. My problem is that the contents in areas splitted are not indexed and therefore not appearing in the search results. I tried solutions appeared in the above threads. But no escape. The names given for the splitted areas are 'a1' and 'b1'. I request help from those who know a solution, please.
ryan replied on at Permalink Reply
ryan
I wrote this up a while back, has some good info in it:

http://www.concrete5.org/help/building_with_concrete5/developers/se...
lphillips replied on at Permalink Reply
lphillips
That's a pretty good article, however i think that the system itself needs changing... We shouldn't really need to override or modify the core just to get our templates to function correctly. Perhaps there should be a search.xml or something in the theme folder that defines searchable areas. After all - The searchable areas are theme dependant.
ryan replied on at Permalink Reply
ryan
Well yeah.. how it should be is certainly different than how it is.

There should be a tab in the dashboard that has a nice ui and allows you to select the areas you'd like indexed with a checkbox and possibly the ability to exclude portions of the site from the indexer by path.
lphillips replied on at Permalink Reply
lphillips
I agree with your idea of exclusion via dashboard however, i really feel that it is the template builders place to specify the "main" content areas.

I'd also be concerned with the user switching themes and rendering the modifications useless if it were to be a theme-independent dashboard setting.
lphillips replied on at Permalink Reply
lphillips
Just realised that the Exclude from search index property already exists... so from this point of view, i'd say that the dashboard is really as comprehensive as it should be...
sceva replied on at Permalink Reply
sceva
Thanks for the post. I have had the same issue, and tried editing the index_search.php file to no avail. Then ran across this post. I added my content areas to the array and the search is working now.

My only complaint with c5 so far is that the documentation is difficult to navigate to find the relevant post...
Mnkras replied on at Permalink Reply
Mnkras
in 5.4 its fixed