Search

I've got a question that has been bothering me for a while...

Is it better to have one datasource or multiple datasources for similar results?

Real life example:

Let's say I have a section 'Fruits'. It contains all the world fruits...

UX wise, I have functionality to search those fruits. And, I also have a page that shows all the search results and another page for the details about the specific fruit.

So, usually, I juts set up one data source with data source filter, and all fields included ,and 'Redirect to 404 page when no results are found' not checked. That way I can use the same data source on the search results page as well as on the details page...

But here's the dilemma... The search results page only contains few of the fields like 'title' and 'description' whereas the details page has all the fields shown...

Is there any benefit of creating separate datasources for search results page and details page? If I have the data-source cache enabled, would it work for the details page?

Yeah, I'd usually separate them in order to speed up the "listing" datasource especially when there are large text fields along with each entry. It's much faster to only return what you need when it comes to returning a lot of data.

I'm using multiple DSs as well. One for fruits list, one for fruit details and even another one if I need a list of only 5 fruits (on arbitrary criteria). So, it's better to separate them.

One DS for each. However if you have two areas on your site where you need to list fruits e.g. a list of latest fruits on the homepage, then listing fruits on a Fruits index page, then it makes sense to reuse the same "listing" DS if you can.

Alternatively, if you displayed the same (or very similar) fields about a fruit on both the listing and detail pages, and just had commenting functionality on the detail page, then it'd make sense to use the same DS as you described.

But I always err on the side of performance — if you're selecting fields you don't need, you're doing it wrong :)

Thank you guys for all the replies. Good insights. I guess I have some optimization to do now...

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details