/** * Add constraint to only contain the terms associated with the terms in the current list * * @param UTCW_QueryBuilder $builder * * @since 2.6 */ public function buildQuery(UTCW_QueryBuilder $builder) { $terms = $this->plugin->getCurrentQueryTerms(); $termIds = array_map(create_function('$term', 'return $term->term_id;'), $terms); $parameters = array(); foreach ($termIds as $termId) { $parameters[] = '%d'; $builder->addParameter($termId); } $builder->addStatement('AND term_id IN (' . join(',', $parameters) . ')'); }
/** * Add random sorting to query * * @param UTCW_QueryBuilder $builder * * @since 2.6 */ public function buildQuery(UTCW_QueryBuilder $builder) { $builder->addStatement('ORDER BY RAND()'); }
/** * Adds sorting by count to the query * * @param UTCW_QueryBuilder $builder * * @since 2.6 */ protected function buildQuery(UTCW_QueryBuilder $builder) { $builder->addStatement('ORDER BY count DESC'); }
/** * Add sorting by term_id (effectively by creation time) to query * * @param UTCW_QueryBuilder $builder * * @since 2.6 */ public function buildQuery(UTCW_QueryBuilder $builder) { $builder->addStatement('ORDER BY term_id DESC'); }