Author: sevein
Date: Sat Apr 28 21:39:19 2012
New Revision: 11540
Log:
Build a table of level of descriptions using raw sql, no culture fallback,
should be in the model class in the future
Modified:
branches/2.0/apps/qubit/modules/search/actions/autocompleteAction.class.php
branches/2.0/apps/qubit/modules/search/templates/autocompleteSuccess.php
Modified:
branches/2.0/apps/qubit/modules/search/actions/autocompleteAction.class.php
==============================================================================
--- branches/2.0/apps/qubit/modules/search/actions/autocompleteAction.class.php
Sat Apr 28 21:37:54 2012 (r11539)
+++ branches/2.0/apps/qubit/modules/search/actions/autocompleteAction.class.php
Sat Apr 28 21:39:19 2012 (r11540)
@@ -33,7 +33,6 @@
$query->setLimit(3);
$query->setSort(array('_score' => 'desc', 'slug' => 'asc'));
- // TODO: have to sort this on "recent" date (IOs only)
$queryString = new Elastica_Query_QueryString($querystring . '*');
$queryString->setDefaultOperator('AND');
@@ -55,12 +54,31 @@
// information objects
$queryString->setFields(array('i18n.title'));
- $query->setFields(array('slug', 'i18n'));
+ $query->setFields(array('slug', 'levelOfDescriptionId', 'i18n'));
$query->setQuery($queryString);
$this->descriptions =
QubitSearch::getInstance()->index->getType('QubitInformationObject')->search($query);
$this->descriptionsHits = $this->descriptions->getTotalHits();
+ if (0 < $this->descriptionsHits)
+ {
+ $sql = '
+ SELECT
+ term.id,
+ term_i18n.name
+ FROM
+ term
+ LEFT JOIN term_i18n ON (term.id = term_i18n.id AND term_i18n.culture =
?)
+ WHERE
+ term.taxonomy_id = ?';
+
+ $this->levelsOfDescription = array();
+ foreach (QubitPdo::fetchAll($sql, array('en',
QubitTaxonomy::LEVEL_OF_DESCRIPTION_ID)) as $item)
+ {
+ $this->levelsOfDescription[$item->id] = $item->name;
+ }
+ }
+
// terms
$queryString->setFields(array('i18n.name'));
$query->setFields(array('slug', 'i18n', 'taxonomyId'));
Modified:
branches/2.0/apps/qubit/modules/search/templates/autocompleteSuccess.php
==============================================================================
--- branches/2.0/apps/qubit/modules/search/templates/autocompleteSuccess.php
Sat Apr 28 21:37:54 2012 (r11539)
+++ branches/2.0/apps/qubit/modules/search/templates/autocompleteSuccess.php
Sat Apr 28 21:39:19 2012 (r11540)
@@ -7,8 +7,10 @@
<?php foreach ($descriptions->getResults() as $hit): ?>
<?php $doc = build_i18n_doc($hit) ?>
- <li><?php echo link_to(($doc[$sf_user->getCulture()]['title'] ?:
$doc[$doc['sourceCulture']]['title']), array('module' => 'informationobject',
'slug' => $doc['slug'])) ?></li>
- <?php // TODO: include description level logic; performance impact? ?>
+ <li>
+ <?php echo link_to(($doc[$sf_user->getCulture()]['title'] ?:
$doc[$doc['sourceCulture']]['title']), array('module' => 'informationobject',
'slug' => $doc['slug'])) ?>
+ <strong><?php echo
$levelsOfDescription[$doc['levelOfDescriptionId']] ?></strong>
+ </li>
<?php endforeach; ?>
<?php if ($descriptions->getTotalHits() > 3): ?>
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.