EllisLab text mark
Advanced Search
     
Configure Search Results
Posted: 27 April 2012 12:47 PM   [ Ignore ]
Avatar
Joined: 2011-12-29
18 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 rel="internal" href="{page_url}">{title}</a></h3>
  <
p>{excerpt}</p>
 </
li
{/exp:search:search_results}
</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

 
Posted: 30 April 2012 12:03 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2005-10-18
7340 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,

 

 Signature 

How may I help you?

 
Posted: 30 April 2012 01:10 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2011-12-29
18 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 rel="internal" href="{page_url}">{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="{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

 
Posted: 30 April 2012 03:41 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2011-12-29
18 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

 
Posted: 01 May 2012 10:30 AM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2005-10-18
7340 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!

 Signature 

How may I help you?