Searching within Custom Tables

Permalink
Hi All

I am working on a site that already have an existing MySQL database with information in that they want to pull into the site. The want to stick with it in its own database as the data is critical to them and will easily outlive the life of a website so they want to be able to simply move the information from site to site as they re-design/develop.

Building a concrete5 interface to edit this in the dashboard is fine and I can build custom blocks to pull the info into the front end the site. The one problem I have though is that the site has a site wide search which needs to search both the concrete5 pages, and this custom database for results.

I could potentially look at something like Google CSE (or equivalent now that it is adds only) that crawls the site from an external POV but I would really like to be able to use the Concrete5 search if possible. Is there any way of extending the core search to index additional tables?

Or am I going about this the wrong way, is there a simpler method?

Any input would be gratefully received.

Many thanks

bvcreative
 
JohntheFish replied on at Permalink Reply
JohntheFish
The core search works on pages, so if rows of your custom tables map 1:1 to pages, then you should be able to join them to the existing join of tables in the sitewide search.

If your custom tables do not map 1:1, then your search is a fundamentally different thing to the core search of pages. You could copy the code of the core search to create a custom search mechanism for your tables.
bvcreative replied on at Permalink Reply
bvcreative
Hi JohntheFish

Many thanks for your reply. Unfortunately my table structure is completely different so joining them won't be possible. Create a duplicate of the existing search code would also just provide me a second search tool and not an integrated search that indexes both locations?

Many thanks
David
JohntheFish replied on at Permalink Reply
JohntheFish
You could make your duplicate/modified search also call the existing site search and merge the results however you like. There could be some issues with pagination, so rather than aiming for one list I would actually display 2 sets of results side-by side.
bvcreative replied on at Permalink Reply
bvcreative
Hi JohntheFish

Thanks again for your response. Yea that was my concern over pagination. Unfortunately, I don't think two separate lists is likely to fly as a solution.

Surely lots of packages have data in their own tables, is there not a way to include that in the main search?

Many thanks
JohntheFish replied on at Permalink Reply
JohntheFish
You could merge your results into a temporary table then page through that. But you essentially have incompatible data. Try a thought experiment, for a particular search that returns custom data and pages, what are your rules for sorting them?
You need to be able to define that simply and deterministically now to stand any hope of being able to code the rules later.