ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Configure Search Results

April 27, 2012 12:47pm

Subscribe [1]
  • #1 / Apr 27, 2012 12:47pm

    nhinshaw

    13 posts

    Hello All,
    I am having an issue with my search results page. I have a pretty simple set up right now:

    <ul id="search-results-list" class="blanklist">
    {exp:search:search_results switch="resultRowOne|resultRowTwo"}
            <li class="{switch}">
      <h3><a href="http://{page_url}rel=internal">{title}</a></h3>
    <p>  {excerpt}<br />
     </li> <br />
    {/exp:search:search_results}<br />
    </ul>

    However there are some factors that complicate the effectiveness (it downright breaks). I have several areas where channel entries are loaded onto a page for display and are never visible on their own page. These results need to show up in the search results, I would just like the user to land on their containing page. Is this possible to do?

    An example would be something like this:
    I have a collection of white papers, each paper has it’s own entry, but they are all displayed on one page.

    Another example would be:
    I have a collection of products, these product are only visible in a select menu on a product parent page. I would like these products to show up in a search as unique items, but when selected the user is taken to the product parent page and can pick the item from the select menu.

    Is there a way to tweak the search to allow this to happen?

    Any help would be greatly appreciated.

    Thanks!
    Nathan

  • #2 / Apr 30, 2012 12:03pm

    Dan Decker

    7338 posts

    Hi Nathan,

    Let me see if I can shed some insight on how results are directed.

    Each channel has a setting for “Search Results URL” that determines what template will be used to display the result. However, it can’t be configured to the level where you can specify an anchor on the page, or as a pre-selection in a drop down. For the most part, search results are expected to be returned to a single entry template.

    Cheers,

     

  • #3 / Apr 30, 2012 1:10pm

    nhinshaw

    13 posts

    Hi Dan, thanks for getting back to me. Also thank you for pointing out the “Search Results URL”, I’ve gone and made a change to a section to see if I can start to pull out the behavior I am after and have a few questions / issues.

    1) I won’t ever need to link to an anchor or a pre-selection in a drop down. I would however have need to point a link to a parent page, but one that is not the same for each item in a channel. Here is an example. I have a selection of products, each paired with a different parent product. I’d like the search results for each product to land the user on the parent page for that product—in this scenario setting the “Search Results URL” might not provide the specificity I need. Do you know if that is that doable?

    2) I changed the “Search Results URL” for one of my channels, however it isn’t being picked up on the Search Results page. Do I need to make a change to my link structure?

    <a href="http://{page_url}rel=internal">{title}</a>

    Using the above structure I am get sets of results one that functions as intended creating a well formed URL and dropping the user at the correct page. Other times it will shoot out something like this:

    /search-results/d4ca44322f9051756004db5b80ccc1a7/

    If I switch to using

    <a href="http://{auto_path}">{title}</a>
    then I get the same issue, plus sometimes it adds the .php back in even though that has been removed from the URLs or it shoots out something like this
    /search-results/69e46c80aed992e982a8f4ab2ce016a8/company/case-studies/a-case-study

    In the above example I have set the “Search Results URL” to be: ‘company/case-studies’ so that is working but the rest is cruft and can’t be shaken so the link never leaves the page, just nests that URL deeper and deeper.

    Please let me know if I can clarify anything above.


    Thanks,
    Nathan

  • #4 / Apr 30, 2012 3:41pm

    nhinshaw

    13 posts

    *Update*
    I figured out my weird path issues - including the whole path in the “Set Custom URL” field. However if I have a page that essential contains a listing of other entries from a channel it still wants to send the user to that entry, whereas I just want them to land on the listing page. So something like this:

    {site_url}/company/case-studies

    entered in the “Custom URL” field returns this: http://example.com/company/case-studies/a-case-study

    I need it to end at case-studies/ - is that possible?

    I am still having a similar issue directing the user to the right product. Where it should be something like http://example.com/shop/parent/ when the user searches for a product contained under that parent.

    I am sure that I am making this more complicated than it needs to be but I’m stymied as to how to approach this.

    Thanks,
    Nathan

  • #5 / May 01, 2012 10:30am

    Dan Decker

    7338 posts

    Hi Nathan,

    I apologize for the confusion, I meant to convey in my first post that the level of control you are after just isn’t possible with the built-in search facility.

    As you’ve discovered with your trial and error, the Search Module in ExpressionEngine behaves in a very specific way, and it can be onerous to change that.

    For broader control and more features, have a look over the comparison chart for ExpressionEngine search options.

    Let me know if you have any other questions.

    Cheers!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases