Created
September 26, 2013 17:54
-
-
Save jraddaoui/6717981 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
radawi@ubuntu:~/www/atom-ac$ git diff | |
diff --git a/apps/qubit/modules/default/actions/moveAction.class.php b/apps/qubi | |
index b5f189f..fb17f24 100644 | |
--- a/apps/qubit/modules/default/actions/moveAction.class.php | |
+++ b/apps/qubit/modules/default/actions/moveAction.class.php | |
@@ -96,26 +96,57 @@ class DefaultMoveAction extends sfAction | |
} | |
$this->parent = QubitObject::getBySlug($this->form->parent->getValue()); | |
- $query = QubitSearch::getInstance()->addTerm($this->parent->slug, 'parent') | |
+ | |
+ $this->query = new \Elastica\Query(); | |
+ $this->query->setLimit($request->limit); | |
+ | |
+ if (!empty($request->page)) | |
+ { | |
+ $this->query->setFrom(($request->page - 1) * $request->limit); | |
+ } | |
+ | |
+ $this->queryBool = new \Elastica\Query\Bool(); | |
if (isset($request->query)) | |
{ | |
- $query = $request->query; | |
+ $query = new \Elastica\Query\QueryString($request->query); | |
+ $query->setDefaultOperator('AND'); | |
+ $this->queryBool->addMust($query); | |
+ } | |
+ else | |
+ { | |
+ $query = new \Elastica\Query\Term; | |
+ $query->setTerm('parentId', $this->parent->id); | |
+ $this->queryBool->addMust($query); | |
+ } | |
+ | |
+ $this->query->setQuery($this->queryBool); | |
+ | |
+ if ($this->resource instanceof QubitInformationObject) | |
+ { | |
+ $resultSet = QubitSearch::getInstance()->index->getType('QubitInformation | |
+ } | |
+ else if ($this->resource instanceof QubitTerm) | |
+ { | |
+ // TODO: | |
} | |
- $this->pager = new QubitArrayPager; | |
- $this->pager->hits = QubitSearch::getInstance()->getEngine()->getIndex()->f | |
+ // Page results | |
+ $this->pager = new QubitSearchPager($resultSet); | |
+ $this->pager->setPage($request->page ? $request->page : 1); | |
$this->pager->setMaxPerPage($request->limit); | |
- $this->pager->setPage($request->page); | |
+ $this->pager->init(); | |
$ids = array(); | |
foreach ($this->pager->getResults() as $hit) | |
{ | |
- $ids[] = $hit->getDocument()->id; | |
+ $data = $hit->getData(); | |
+ $slugs[] = $data['slug']; | |
} | |
$criteria = new Criteria; | |
- $criteria->add(QubitObject::ID, $ids, Criteria::IN); | |
+ $criteria->addJoin(QubitObject::ID, QubitSlug::OBJECT_ID); | |
+ $criteria->add(QubitSlug::SLUG, $slugs, Criteria::IN); | |
$this->results = QubitObject::get($criteria); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment