When you make a change to your Search Results URL, is this reflected on your results page?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
February 10, 2011 4:56pm
Subscribe [7]#31 / Mar 01, 2011 4:00pm
When you make a change to your Search Results URL, is this reflected on your results page?
#32 / Mar 01, 2011 4:06pm
No, it acts like I have made no settings to the search results URL setting at all. In the above example, the search results for the child pages of the ‘About’ section, all try and link to the page URL minus the parent directory, (the ‘About’ in the URL does not show up).
#33 / Mar 02, 2011 11:06am
Did you set up a single entry page for each of those channels? For instance, you mention the About template group. Is there a single entry template that goes with that template group?
#34 / Mar 02, 2011 2:32pm
I’m going to apologize for stepping in here, but this is getting confused, and you’ve said you’re about to launch, grounded.
Here’s something I’ve tried, and works for your case.
- first, each of your Channel Preferences needs something different than you are putting in the Search Results URL of its Path Settings, according to your recent picture. You need there a path to the _template_ which will show each found page—when you click on its title that shows in the search results. For example, http://yoursite.com/templategroup/singlepage, where singlepage is a template that displays just one entry.
It’s what EE people are forever calling a single-entry template. It contains an ordinary exp:channel:entries tag set, with limit=1, and _without_ any setting for dynamic, which means the entry will be selected automatically from the name in the URL path calling it. Otherwise, very similar to your usual entries viewing page.
It’s very unfortunate that the channel paths setting is called Search Results URL, as this confuses with the results page which you name in your search form setup, which uses the exp:search_search_results tag. Now you know.
- second, EE will then automatically choose the particular singlepage template identified for a given channel in its paths, for each line in the search results that is located in that channel. I just tried it, and it works.
- your third issue is the excerpts custom field identification.
[Edit: removed discussion of if-else code block for future viewing, as it’s neither easy nor needed. EE will also take care of proper excerpt fields automatically, as explained further on.]
To recap, the process of search has three stages:
1. search form, built with the exp:search_simpleform tag on your normal pages, or in an embed which is in them.
2. search results, built with the exp:search:results tag, which lists the results found, and automatically makes the link on each line point to the appropriate result view page according to channel path search url preference.
3. result view, which is a page you provide which shows a single entry only, allowed to choose the entry automatically from its calling URL path. You name that page in the per-channel Paths settings, as ‘Search Results URL’. Probably you have such a page already, for showing a single page with comments, for example, and that is what Sue is asking about in her reply just above.
Hoping it helps you get flying, grounded 😉
I will check in later in the day to see how it’s going.
Regards, and apologies again to the stressed Support team,
Clive
#35 / Mar 02, 2011 5:04pm
Did you set up a single entry page for each of those channels? For instance, you mention the About template group. Is there a single entry template that goes with that template group?
Most channels i have multiple templates for, a couple channels I use only 1 template
#36 / Mar 02, 2011 5:11pm
BTW, in the interest of time, the client has decided that having the site live is priority one, so now you can see how my search is reacting live:
try the search field at the top, and see the results.
Thx Narration, I will try and see if I can get this to work now.. stand by if I post more questions..
#37 / Mar 02, 2011 5:35pm
OK, for instance, for simplicity sake, lets say I need to find a page in ‘About’ section o f my site.
If i do a search for ‘Publications’, it will find the ‘Recent Publications’ page.The link does not work. All the ‘about’ pages, use the same template. ‘index’ template
For the search results URL for my ‘About’ channel, am i suppose to put ‘http://www.onami.us/index.php/About/index’ ?
I just tried, and had no effect on search outcome for the ‘recent publications’ page
regarding the code
{ if channel_short_name == 'research'}
<a href="http://{title_permalink=research}">{title}</a>
{/if}
{if channel_short_name == 'other-channel'}
<a href="http://{title_permalink=other-channel}">{title}</a>
{/if}
{if channel_short_name != ''}
<a href="http://{title_permalink}">{title}</a>
{/if}Where exactly do I need to put this code, on which page? Template page I would assume… where in the table code ‘should’ this code go?
#38 / Mar 02, 2011 5:56pm
Ok, I am back with you, grounded. Great site, by the way, and great subject of it. I lived in Oregon a long time, several times; find this advance is fun to know.
I tried your search, for recent publications. I got a reasonable-looking result, but as you said, the actual link pointed to http://www.onami.us/index.php/recent_publications, which failed.
Now, I added what is apparently your desired template group to this URL, so that it reads: http://www.onami.us/index.php/about/recent_publications. And indeed, this link works, and the result it takes me to offers some recent publications, so I think it is what you would intend.
[Edited out the rest, which was relating to the if/else code block which had been discussed earlier in this long thread.
There’s no need for it, as EE turns out to be quite thoughtful how it will allow you to manage and automatically integrate multiple search channels at once, including their differing viewing templates, and their individual choices of excerpt fields.
It’s easy, for the power obtained, and we will show how.]
#39 / Mar 02, 2011 6:06pm
[Edit: deleted for clarity. More on that code block that’s not needed]
#40 / Mar 02, 2011 6:36pm
[edited - here we move past that code block idea, after all, and start a step-by-step to get all the special EE search abilities up and working to solve the needs for this site. This is the first step.]
To get your first example ‘recent publications’ search to work properly, we don’t need the if-code block at all. Leave it out of your templates, and we will settle that part after the path problem that’s showing up first.
What we need at present is that you properly set the Search Results URL in your channels—we will do that first for this ‘about’ template group, so that it automatically arranges what I did manually for results above.
Please go to the Channel Preferences for your channel which holds the results for the recent publications search. This channel I might guess is also called about, and is related to the about template group.
Set the Search Results URL under Path Settings for this channel to http://www.onami.us/index.php/about/.
Be sure to Clear all caches, from the Utilities>Data>Clear Caching menu.
Now, test the search for recent publications. It should show a results page as before, and the link should work this time, automatically using the index page from the about template group as I think it has been doing here, and thus showing the recent publications item that search discovered.
Let’s see that this works for you, and then we’ll discuss what you want and need to do to get the rest of function, one step at a time. Ok?
C.
[Edit further: a little quick conversation then ensued here, leading to an offline chat session, as while I was writing the rest of the steps, grounded had more of his site fail after he cleared caches. That wasn’t to do with the search issue, but rather some change which seems to have been made in his underlying Structure setup, not visible until older results were out of the cache.]
#41 / Mar 02, 2011 7:08pm
OOH crap,
I cleared ‘All Caches’ now my pages arent linking…. did i do somehting bad?!
#42 / Mar 02, 2011 7:10pm
holy cow this is bad, now all my researcher pages, and news story links are no longer working…. .please help
#43 / Mar 02, 2011 7:13pm
Looks like clearing ‘all’ that cache, deleted ALL my automated structure URLS for all the channel entries…
this is not good..
#44 / Mar 02, 2011 7:20pm
[Edit: this was being written as grounded was getting into trouble with the cache cleared issue on another page, so it’s a little out of place in the stream. But it does contain the rest of the solution, and explanation how it works.
We caught up on the other situation below, and will return to what’s here appropriately.]
Ok, the rest is here, with explanation. I have a model of your full situation set up now, and it is working correctly.
We are not going to need the if-code block and its problems - EE abilities have covered the needs here, with a little help from you.
1. The individual search results lines have their links automatically set to the template which should show them. To enable this, you must simply identify this template in the Search Results URL settings, appropriately for each channel.
2. Further, the correct excerpt field will be shown automatically for results from each channel. You arrange this by setting that excerpt field for that channel. It should for clarity really should be in Paths next to the setting for Search Results URL, but in fact it is the next accordion section, the channel Administrative Preferences, on a pulldown menu at bottom of the view.
3. To have the field you want available as a choice for excerpt, you must first have set it to being Searchable on its field definition, before you use the channel Adminstrative Preferences. I think you understood that from conversation before, but it can’t hurt to remind.
Now, how do you get the right kind of template to properly show the entries, from their links which the search has now placed on its home/searchresults (for your site) page, and with their proper excerpts?
This depends entirely on your site.
If a number of channels have just the same fields of information to be shown, and with the same text, titles, and layout around them, for those you could use one general-purpose page. You would just set the channel parameter for that page to include all the channels that might use it: channel=“chan-a|chan-b|chan-c”, for example. You’d then set that url/templategroup/template as Search Results URL settings for each channel that used it.
Where your channels have individual needs for fields included, text and titles, and/or layout, then you need a specific display page for that channel. You’ll name that display page as the siteurl/templategroup/showtemplate in the Search Results URL settings for the channel. The templategroup will be natural one for that channel.
The likely case is that some channels and their needs are a bit different, and so you will have a separate templategroup/showtemplate for each of them, to use in each channel’s Search Results URL settings.
Right now, you’re using the default template for the about template group, the one probably named index, so that your Search Results URL doesn’t actually end with the template name. What is in a typical index template will often actually work, given that dynamic=“no” has not been set in its entries tag.
That fact may get you on the air quickly for search on this onami site, as you need. You can just name the template group appropriate for each of the other channels in their Search Results URL, with trailing slash. Then things may just work, at least many of them.
To refine, you’d make or use a more specific templategroup/showtemplate on a channel. If you have a template for displaying individual comments, that’s often set up as a single-entry template, and one which will show everything, including comments, so it can be a good candidate instead of constructing something new.
Whatever template you choose, you’ll name its path with site URL, template group, and template in Search Results URL setting. For example, “http://www.onami.us/index.php/atemplategroup/atemplate/.
grounded, I hope that completes a picture.
I suspect you can get search fully or nearly fully on the air quickly, by putting in just siteurl/templategroup/ paths for Search Results URL on each of your channels, following steps above. This would give you the quieter time to develop any more specific display templates that you may need to complete the intended site design.
Let us know how it goes.
Best regards,
Clive
#45 / Mar 02, 2011 7:24pm
Ok, back with you, grounded. We were writing at the same time.
Note that I have a working model of your situation, so I think it will be quick to recover.
If clearing your caches broke things, that just indicates that they aren’t set up properly yet.
Let’s do the first step only, duplicating what I was able to test for your site without being there.
As above, please put the following in Search Results URL settings for the channel where that ‘recent publications’ search is supposed to be found: http://www.onami.us/index.php/about/.
Then clear caches, and test the search ‘recent publications’. Then test its link to be sure it’s automatically connected correctly now.
I’ll be here for your result.