Hello,
Revisiting this problem from a year ago. I have built a search page from the blog section of a site and the search is functioning except for one thing: the URL for for the found pages doesn't include the blog slug. For example, the result_url for the found page will be "//2019-04-22-new-adoption" rather than "/blog/2019-04-22-new-adoption".
The search results page uses this code:
Code
- <li class="<perch:search id="perch_item_odd" />">
- <h2><a href="<perch:search id="result_url" />"><perch:search id="result_title" /></a></h2>
- <perch:if exists="result_excerpt"><p class="excerpt">…<perch:search id="result_excerpt" encode="false" />…</p></perch:if>
- <p><a href="<perch:search id="result_url" />">
- <perch:if exists="result_pageNavText">
- <perch:search id="result_pageNavText" />
- <perch:else />
- <perch:search id="result_url" />
- </perch:if>
- </a></p>
- </li>
Debug shows this:
Quote
get_route(): ">[52] SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate, pr.routeOrder, s.settingValue AS siteOffline FROM perch3_pages p LEFT JOIN perch3_page_routes pr ON p.pageID=pr.pageID LEFT JOIN perch3_settings s ON s.settingID='siteOffline' UNION SELECT NULL AS pagePath, pr2.routePattern, pr2.routeRegExp, pr2.templatePath AS pageTemplate, pr2.routeOrder, NULL AS siteOffline FROM perch3_page_routes pr2 WHERE templateID!=0 ORDER BY routeOrder ASC, pagePath ASC get_route(): ">Matched page: /search_results, so not using routes. Using master page: /templates/pages/search_display.php get(): ">[36] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0 find_by_path(): ">[1] SELECT * FROM perch3_pages WHERE pagePath='/search_results' LIMIT 1 template_attributes(): ">Using template: /templates/pages/attributes/default.html find_all_tag_ids(): ">Using sub-template: /templates/pages/attributes/seo.html find_all_tag_ids(): ">Using sub-template: /templates/pages/attributes/social.html _get_content(): ">[1] SELECT regionKey, regionHTML FROM perch3_content_regions WHERE regionPage='/search_results' OR regionPage='*' ORDER BY regionPage DESC __construct(): ">Using template: /templates/search/search-form.html search_content(): ">Search term: programs for adoption and surrogacy search_content(): ">[10] SELECT SQL_CALC_FOUND_ROWS DISTINCT 'PerchContent_SearchHandler' AS source, MATCH(ci.itemSearch) AGAINST('programs for adoption and surrogacy') AS score, r.regionPage AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, r.regionOptions AS col4, p.pageNavText AS col5, p.pageTitle AS col6, regionTemplate AS col7, r.regionKey AS col8 FROM perch3_content_regions r, perch3_content_items ci, perch3_pages p WHERE r.regionID=ci.regionID AND r.regionRev=ci.itemRev AND r.pageID=p.pageID AND r.regionPage!='*' AND r.regionSearchable=1 AND (MATCH(ci.itemSearch) AGAINST('programs for adoption and surrogacy') OR MATCH(ci.itemSearch) AGAINST('programs for adoption and surrogacy') ) AND (r.regionPage LIKE '/%') UNION SELECT 'PerchContent_RunwaySearch' AS source, MATCH(ci.itemSearch) AGAINST('programs for adoption and surrogacy') AS score, c.collectionKey AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, c.collectionOptions AS col4, c.collectionKey AS col5, c.collectionKey AS col6, collectionTemplate AS col7, c.collectionKey AS col8 FROM perch3_collections c, perch3_collection_items ci, perch3_collection_revisions cr WHERE c.collectionID=cr.collectionID AND cr.itemID=ci.itemID AND cr.itemRev=ci.itemRev AND c.collectionSearchable=1 AND cr.itemSearchable=1 AND (MATCH(ci.itemSearch) AGAINST('programs for adoption and surrogacy') OR MATCH(ci.itemSearch) AGAINST('programs for adoption and surrogacy') ) UNION SELECT 'PerchBlog_SearchHandler' AS source, MATCH(postTitle, postDescRaw, postTags) AGAINST('programs for adoption and surrogacy') AS score, postTitle, postSlug, postDateTime, postDescHTML, postID, sectionSlug, "", "" FROM perch3_blog_posts p, perch3_blog_sections s WHERE postStatus='Published' AND postDateTime<'2019-05-13 16:17:54' AND p.sectionID=s.sectionID AND MATCH(postTitle, postDescRaw, postTags) AGAINST('programs for adoption and surrogacy') ORDER BY score DESC LIMIT 0, 10 get_value(): ">[59] SELECT FOUND_ROWS() AS `count` search_content(): ">[10] Using template: /templates/search/search-result.html Request time: 0.0429 Process time: 0.0428 Memory: 1.3696
And showall gives me this:
Quote
perch_page_path /search_results url //2019-04-22-new-adoption-surrogacy-programs-in-ovia-health title New adoption & surrogacy programs in Ovia Health excerpt Ovia Health's maternity & family benefits now include programs for adoption and surrogacy{...} key programs for adoption and surrogacy source PerchBlog result_url //2019-04-22-new-adoption-surrogacy-programs-in-ovia-health result_title New adoption & surrogacy programs in Ovia Health result_excerpt Ovia Health's maternity & family benefits now include programs for adoption and surrogacy{...} result_key programs for adoption and surrogacy result_source PerchBlog search_key programs for adoption and surrogacy paging true total 59 number_of_pages 6 total_pages 6 per_page 10 current_page 1 lower_bound 1 upper_bound 10 prev_url next_url /search_results?q=programs+for+adoption+and+surrogacy&page=2 prev_page_number next_page_number 2 first_page_url /search_results?q=programs+for+adoption+and+surrogacy last_page_url /search_results?q=programs+for+adoption+and+surrogacy first_page true not_last_page true perch_item_first true perch_item_zero_index 0 perch_item_index 1 perch_item_rev_index 10 perch_item_rev_zero_index 9 perch_item_odd perch_item_count 10 perch_index_in_set 1 perch_zero_index_in_set 0 perch_first_in_set true perch_namespace perch:search
Finally, in settings, theBlog post page path is
and the slug format is:
I'm at a complete loss.
Thanks, Tim