Ticket #145 (closed defect: fixed)
Search results and automatic choice of best engine page for a given engine route
| Reported by: | boutell | Owned by: | tboutell |
|---|---|---|---|
| Priority: | major | Milestone: | 1.5 |
| Component: | Documentation | Version: | 1.5 |
| Keywords: | engines, blog, search, 1.5rc2 | Cc: | boutell, agilbert, wjohnald, johnnyoffline, jake, |
| Symfony version: | 1.4 |
Description
We support more than one engine page per engine module. This raises the question of which engine page should be linked to for a given link_to or url_for call.
We already support expressly pushing an engine page as the target and then popping it afterwards.
However we now have a new issue: virtual pages in search results. Right now they are coming up as as bogus links to the virtual pages that contain that content.
We should block that, ignoring them like the 'global' page. But this raises a larger issue: how *should* we link back to blog posts in search results? They are implemented as areas, there should be permalinks back to the blog posts, not nothing at all.
A possibility: if the slug contains a slash, but does not start with a slash, it's a Symfony URL. This is very elegant. It leverages the symfony routing engine instead of reinventing the wheel. (If there is no slash at all we need to ignore it in search results entirely)
But what happens when that symfony URL points to an engine route and there is more than one engine page, as is typically true for the blog plugin? Which engine page should get the permalink?
I see two possibilities:
1. Post an event with the sfRoute object. The engine can then decide which of its engine pages should win. If it doesn't respond my usual default algorithm wins. This cleverness would need to be invoked in aRouteTools::addPageToUrl.
(If the winning page has the admin flag and the user is not a potential editor (aTools::isPotentialEditor, something like that), ignore this search result, pre-pagination so we don't wind up with page 1 having nothing on it)
2. Forget trying to merge virtual pages with fully paginated site search results at all. Instead, ignore all virtual pages in the regular search and post an event from the search action to fetch other search results and integrate them into the site search results via separate "teaser" components, with a link back to the main search feature for that particular plugin if you want more results of that kind.
The latter, honestly, is consistent with stuff we've done successfully in other places. Merging search results can be tricky and confusing. It's also slow though - two Zend searches where one would do if we got the routing right.
I think we should take a deep breath and tackle the cool way (#1).
Dan, on reflection I am assigning this to you because you are working on the blog plugin and you need this right now. I want to do it but it's not in my field of view at the moment. Tap me on the shoulder for anything you have doubts or questions about and make sure we do code review of it together before it's official.

