Search

Are there any downsides using union datasource performance wise?

I can't say with 100% confidence, but I think a Union Datasource is actually cheaper and quicker than the alternative.

At the moment it's not possible to do what you can do with a Union Datasource without turning off pagination of the other datasources (ie. return every entry in each section) and then do the sort/limiting in XSLT. This means large data sets, and overhead for each datasource.

Union Datasource actually only does one query to get the Entry ID's for all the datasources and all sorting/limiting is done by MySQL, so I think it'd be close to or faster.

It's definitely much easier to use XSLT wise!

OK. Thanks for the input. Sounds reasonable.

I am playing with Union Datasource now and I have hit couple of sticking points.

Firstly, I have 2 sections, 'Section A' and 'Section B'. Section B is filtered by {$ds-section-a}. It works fine when I include those two datasources separately on a page. But... When I create a Union Datasource with these two sections then filtering ceases to work. It applies well whatever filters I have set for Section A, but displays all results from Section B, completely ignoring {$ds-section-a}. Is this a konown limitation or a bug?

Secondly, I think the pagination is . On my case Section B serves as a child of Section A. Pagination simply counts all the results in union datasource. But it's not useful at all... I may have only 10 results from section A and 4-5 from Section B. It simply doesn't make sense

Any practical advice how to overcome these limitations?

Union datasource doesn't handle dependencies between datasources, its in the readme. That said, little unsure how you'd like it to work in your case. The union datasource combines two datasources together, what you seem to be after is to execute one datasource and then have another execute based off those results. I'm unsure how union would help here instead of normal datasource chaining? How were you hoping it would work? What result are you after?

First off, this is awesome. I'm in the process of integrating it into one of my spare-time/experimental projects.

One question I have is whether it's possible to return a 404 when no results are returned from a Union Datasource. My knowledge of Symphony's internals is still pretty limited; I'm not sure how hard this would be to implement.

Union Datasource updated to version 0.5 on 16th of June 2011

  • Support Required URL Parameter
  • Support Redirect to 404 page when no results are found

@atbradley Version 0.5 should implement that for you :) Enjoy

Awesome, thanks.

I wish I could get this level of service for software I've paid for. :)

Heh, your welcome. Let me know if anything else comes up :)

I'm having a bit of trouble under 2.2.2:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION ALL UNION ALL UNION ALL LIMIT 0, 10' at line 1
An error occurred while attempting to execute the following query

UNION ALL UNION ALL UNION ALL LIMIT 0, 10

The error seems to be occurring in /extensions/uniondatasource/lib/class.uniondatasource.php:421 according to the backtrace.

Edit: the problem isn't unlike comment #6 but I'm filtering the datasources using equal to or earlier than now. Changing to just earlier than now has no effect.

If you remove all your filters does it work?

Just before line 421, can you var_dump($this->data) and pastie the result?

$this->data is fairly short:

array(3) { ["section"]=> array(1) { [0]=> bool(false) } ["sort"]=> array(4) { [0]=> NULL [1]=> NULL [2]=> NULL [3]=> NULL } ["sql"]=> array(4) { [0]=> NULL [1]=> NULL [2]=> NULL [3]=> NULL } }

Or: http://pastie.org/2370808

If I remove all filters (besides equal to or earlier than now on date I was filtering a few checkboxes), the error goes away, and the page seems fine.

Here's $this->data without the filters: http://pastie.org/2370820

Edit: I've also tried adding the date filter back in, and it only seems to cause a problem using something involving earlier than now. That is, 1970 to 2012, later than 1970, etc. all seem to work fine.

I've mostly managed to fix the problem. I believe it's a problem with equal to or earlier than now, rather than the union datasources, since I discovered that other datasources using that filter were not returning any results. After replacing that filter with 2011 to now everything is working. Should I file a bug?

Yeah, please do. Don't forget to include some environment information (PHP version, OS, Symphony version and type of field used) to help debug. It has to be said that I can't currently reproduce the bug, equal to or earlier than now works as advertised in my testbed installation so I'm curious :)

Union Datasource updated to version 0.5.1 on 13th of September 2011

Hi guys,

Is there any way to limit each of the sub datasources? I'd like to make sure one of my 3 unified datasources only adds a limited number of records to the xml... Is it doable?

Cheers.

Interesting idea. No it's currently not possible but I could look at it.

Just to clarify, you mean that if you had 3 datasources, you could limit one of them to only return 5 entries, regardless of filtering. Sort of like a MAX results per datasource per page?

Hi Brendo, that's exactly it... can you do it?

Cheers!

I can take a look but at this stage I'm not sure how it'd be implemented as the results are fetched solely with SQL

Sure, that's what I thought... I'm new to symphony so not sure where to try and edit your code. And besides, I'm not sure how the SQL is formed and where to try and put a limit. If you could help, that would be great!

Cheers.

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