Published by Mijingo

movie icon image

EE Insider Blog

Spend your time learning and developing sites with ExpressionEngine and we'll use this blog to keep you informed of all the news related to ExpressionEngine and CodeIgniter.

» Read more in the Archives.

» Have a tip? Send us your EE news.

Learn ExpressionEngine Today

Over a series of 8 videos, watch and learn as Ryan builds an entire ExpressionEngine website from beginning to end. Get started now.

In the Forums: Organize search results by weblog

This will be a regular feature where I highlight an interesting EE Forums thread.

Deron Sizemore helps someone organize their search results by weblog by using a conditional checking for the weblog_id.

Where it gets tricky is if I wanted to give each section a header (e.g. h5) with the weblog name but not show it if there are no results from that weblog? How would you handle that?

Posted on Jan 10, 2009 by Ryan Irelan

Filed Under: EE Add-ons, EE Modules, Search Module, In the Forums

Deron Sizemore18:09 on 01.10.2009

Yes, I agree with Brandon. This is a fantastic idea! Thanks for including me.

Where it gets tricky is if I wanted to give each section a header (e.g. h5) with the weblog name but not show it if there are no results from that weblog? How would you handle that?

Good question. I’ve never needed to do something like this so not sure how it’s done. I generally just combine all results for every weblog.

Richard Angstmann06:40 on 01.11.2009

I think Robin (Sowell) helped me out with a bit of php code on my last project to achieve exactly what you’re talking about re: not showing headers of weblogs that have no results.

I will have a look and see what I can dig out.

Chad Crowell06:51 on 01.11.2009

Looks to me that Deron’s code doesn’t organize by weblog, but instead just allows different content/formatting based on the weblog.  I’ve done this before, but your post led me to believe that he was showing all results from weblog a then those from weblog b under that, etc.

Ryan Irelan08:44 on 01.11.2009

That’s a good point, Chad. That code as Deron has it will treat each result based on the weblog. Have you done sorting by weblog in search results? It will be interesting to see different approaches (using EE tags or PHP) to this problem.

Deron Sizemore11:24 on 01.12.2009

Yeah, you’re right. I never even caught on to that after reading the post and then commenting on the post. lol. My code is just throws all results from every weblog into the search results. I generally don’t separate the results out by individual weblog but just have them all together on the same page and then I might have a small snippet of code saying what weblog that result came from.

Mark J. Reeves14:17 on 01.13.2009

I’m actually looking at doing this as a way of providing the user relevance in their search results. My plan is to tier the results based on three different weblogs:

1. Company Info

2. News/Press

3. Product Info

Where each header displays five results beneath it and then has a link to view all results.

I may manage the first portion through my own SQL and then trigger the respective searches when you click through to the full results within a weblog. I’ve done “Search Within” functionality by setting up a single field Advanced Search form with the re-submitted values in hidden fields, and I’ve used JavaScript to resubmit a search using Sort By links.

I believe you can actually submit search with sort by weblog as a parameter, though it’s not documented. See http://www.cgcareers.org/search/results where I’ve added “Site Section” as a sort by option in the Advanced Search and Search Results pages.

The biggest concern for me when I try to filter within search results is breaking pagination. You can always put conditionals around the output, but having 10 results on one page and only 2 on the next because you’ve hidden a few results is sloppy, and built-in pagination is one of the reasons to turn to built-in search.

Mark

Travis Schmeisser11:11 on 01.14.2009

@Ryan Could you maybe use the count variable + if no results to only output the title once if entries exist? The docs don’t have those listed within the search results tag, but most other weblog tags work so it might.

wregmetress08:36 on 07.30.2009

It is fun and money at the same time and not many people have that luxury.
<a >dceol</a>

PissossyWef07:28 on 08.15.2009

Good evening

I have bought new desktop PC and was thinking what antivirus software to buy?
Thanks!

Denise13:26 on 09.05.2009

Hi

Whenever I want to burn a data CDRW on iTunes it makes this strange clicking noise and doesn’t end up burning the CD.
I tried using the regular drag and drop onto the DVDRW burning folder itself and it still makes this odd clicking noise.
I’m using tdk DVDRW and they worked fine when I first got them then all of a sudden it’s doing this.
I’ve tried another brand of disk (sony) and it’s still making the same noise…

Recommendations someone?


_________________
Best <a >fapturbo review</a>

Funn15:51 on 09.06.2009

Cheers

When I want to burn a music CDRW on iTunes it starts making this weird clicking sound and doesn’t end up burning the DVDRW.
I tried using the regular drag and drop onto the DVD burning folder itself and it still makes this weird clicking sound.
I’m using noname CDRW and they worked fine when I first got them then all of a sudden it’s doing this.
I’ve tried another brand of disk (Maxell) and it’s still making the same noise…

Recommendations someone?


_________________
Best <a >fapturbo</a>

Slacketatmela13:32 on 02.14.2010

While i was scouting around at this page and have found it to be truly valuable. I would really value almost any help.

Lately, Louisville has blossomed as a major center for the health care and healthcare sciences sectors. Louisville has been core to advancements in heart and hand surgery as well as cancer remedy. A number of of the very first manufactured heart transplants were made in Louisville. Louisville’s thriving downtown medical research university comprises of a new $Eighty-eight million rehabilitation heart, and a wellbeing sciences study and commercialization recreation area that, in partnership with the University of Louisville, has lured nearly 70 top rated scientists and investigators. Louisville can be also home to Humana, one particular of the nation’s most significant health insurance cover businesses.

Louisville is home to many major organizations and establishments.