protected function _actionGet(AnCommandContext $context)
    {
        $this->setView('searches');

        if ($this->actor) {
            $this->getToolbar('actorbar')->setTitle($this->actor->name);
            $this->getService()->set('com:search.owner', $this->actor);
        }

        $this->_state
             ->insert('term')
             ->insert('scope')
             ->insert('search_comments')
             ->insert('search_nearby')
             ->insert('search_range')
             ->insert('search_leaders');

        $this->getService('anahita:language')->load('com_actors');

        $this->keywords = array_filter(explode(' ', $this->term));

        $this->scopes = $this->getService('com:components.domain.entityset.scope');

        $this->current_scope = $this->scopes->find($this->scope);

        $query = $this->getService('com:search.domain.query.node')
                      ->searchTerm($this->term)
                      ->limit($this->limit, $this->start);

        if ($this->actor) {
           $query->ownerContext($this->actor);
        }

        if ($this->search_comments) {
            $query->searchComments($this->search_comments);
        }

        if ($this->search_nearby && ($lnglat = $this->_geocoder->geocode($this->search_nearby))) {
            $query->searchNearby($lnglat);
            $query->searchRange($this->search_range);
        }

        if ($this->current_scope) {
            $query->scope($this->current_scope);
        }

        if ($this->sort == 'recent') {
            $query->order('node.created_on', 'DESC');
        } elseif ($this->search_nearby && $this->sort == 'distance' ) {
            $query->order('distance', 'ASC');
        } else {
            $query->orderByRelevance();
        }

        //print str_replace('#_', 'jos', $query);

        $entities = $query->toEntitySet();

        $this->_state->setList($entities);

        parent::_actionGet($context);
    }
protected function _actionGet(AnCommandContext $context)
    {
        $this->setView('searches');

        if ($this->actor) {
            $this->getToolbar('actorbar')->setTitle($this->actor->name);
            $this->getService()->set('com:search.owner', $this->actor);
        }

        $this->_state
             ->insert('term')
             ->insert('scope')
             ->insert('search_comments')
             ->insert('search_nearby')
             ->insert('search_range')
             ->insert('search_leaders');

        $this->getService('anahita:language')->load('com_actors');

        $this->keywords = array_filter(explode(' ', $this->term));

        $this->scopes = $this->getService('com:components.domain.entityset.scope');

        $this->current_scope = $this->scopes->find($this->scope);

        $query = $this->getService('com:search.domain.query.node')
                      ->searchTerm($this->term)
                      ->limit($this->limit, $this->start);

        if ($this->actor) {
           $query->ownerContext($this->actor);
        }

        if ($this->search_comments) {
            $query->searchComments($this->search_comments);
        }

        if ($this->search_nearby && ($lnglat = $this->_geocoder->geocode($this->search_nearby))) {
            $query->searchNearby($lnglat);
            $query->searchRange($this->search_range);
        }

        if ($this->current_scope) {
            $query->scope($this->current_scope);
        }

        if ($this->sort == 'recent') {
            $query->order('node.created_on', 'DESC');
        } elseif ($this->search_nearby && $this->sort == 'distance' ) {
            $query->order('distance', 'ASC');
        } else {
            $query->orderByRelevance();
        }

        //print str_replace('#_', 'jos', $query);

        $entities = $query->toEntitySet();

        $this->_state->setList($entities);

        parent::_actionGet($context);
    }
protected function _actionGet ( AnCommandContext $ context ) { $ this -> setView ( 'searches' ) ; if ( $ this -> actor ) { $ this -> getToolbar ( 'actorbar' ) -> setTitle ( $ this -> actor -> name ) ; $ this -> getService ( ) -> set ( 'com:search.owner' , $ this -> actor ) ; } $ this -> _state -> insert ( 'term' ) -> insert ( 'scope' ) -> insert ( 'search_comments' ) -> insert ( 'search_nearby' ) -> insert ( 'search_range' ) -> insert ( 'search_leaders' ) ; $ this -> getService ( 'anahita:language' ) -> load ( 'com_actors' ) ; $ this -> keywords = array_filter ( explode ( ' ' , $ this -> term ) ) ; $ this -> scopes = $ this -> getService ( 'com:components.domain.entityset.scope' ) ; $ this -> current_scope = $ this -> scopes -> find ( $ this -> scope ) ; $ query = $ this -> getService ( 'com:search.domain.query.node' ) -> searchTerm ( $ this -> term ) -> limit ( $ this -> limit , $ this -> start ) ; if ( $ this -> actor ) { $ query -> ownerContext ( $ this -> actor ) ; } if ( $ this -> search_comments ) { $ query -> searchComments ( $ this -> search_comments ) ; } if ( $ this -> search_nearby && ( $ lnglat = $ this -> _geocoder -> geocode ( $ this -> search_nearby ) ) ) { $ query -> searchNearby ( $ lnglat ) ; $ query -> searchRange ( $ this -> search_range ) ; } if ( $ this -> current_scope ) { $ query -> scope ( $ this -> current_scope ) ; } if ( $ this -> sort == 'recent' ) { $ query -> order ( 'node.created_on' , 'DESC' ) ; } elseif ( $ this -> search_nearby && $ this -> sort == 'distance' ) { $ query -> order ( 'distance' , 'ASC' ) ; } else { $ query -> orderByRelevance ( ) ; } //print str_replace('#_', 'jos', $query); $ entities = $ query -> toEntitySet ( ) ; $ this -> _state -> setList ( $ entities ) ; parent :: _actionGet ( $ context ) ; }
Search and return the result.

@param AnCommandContext $context Controller command chain context

@return string The result to render
Search and return the result .