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?
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?
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.
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..
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..
...searching all the areas by default would make more sense.
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.
Thanks for finding this. It's been driving me crazy for a week.
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."); }
Viewing 15 lines of 28 lines. View entire code block.
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.
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.
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.
I wrote this up a while back, has some good info in it:
http://www.concrete5.org/help/building_with_concrete5/developers/se...
http://www.concrete5.org/help/building_with_concrete5/developers/se...
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.
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.
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.
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.
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.
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...
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...
My only complaint with c5 so far is that the documentation is difficult to navigate to find the relevant post...
in 5.4 its fixed
$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.