function process()
 {
     if (empty($this->data) or trim($this->data['Tag']['search']) == '') {
         $this->Session->setFlash('Please, enter a search term');
         $this->redirect(array('controller' => 'tags', 'action' => 'index'));
     }
     if (empty($this->data['Option']['id']) or count($this->data['Option']['id']) == 0) {
         $this->Session->setFlash('Please select a search option');
         $this->redirect(array('controller' => 'tags', 'action' => 'index'));
     }
     $repo = $this->requireRepository();
     $words = explode(',', trim($this->data['Tag']['search']));
     //fix: el separador es coma, no espacio
     $documents = array();
     if (in_array("title", $this->data['Option']['id'])) {
         $documents_aux = $this->Document->findDocumentsByTitle($repo['Repository']['id'], $words);
         $documents = $this->addContent($documents, $documents_aux);
         //agregar documentos al conjunto
     }
     if (in_array("content", $this->data['Option']['id'])) {
         $documents_aux = $this->Document->findDocumentsByContent($repo['Repository']['id'], $words);
         $documents = $this->addContent($documents, $documents_aux);
         //agregar documentos al conjunto
     }
     if (in_array("filename", $this->data['Option']['id'])) {
         $documents_aux = $this->Attachfile->findDocumentsByFilename($repo['Repository']['id'], $words);
         $documents = $this->addContent($documents, $documents_aux);
         //agregar documentos al conjunto
     }
     if (in_array("tags", $this->data['Option']['id'])) {
         $documents_aux = $this->Tag->findDocumentsByTags($repo['Repository']['id'], $words);
         $documents = $this->addContent($documents, $documents_aux);
         //agregar documentos al conjunto
     }
     $documents = $this->Criteria->filterDocuments($documents, $this->data['Criteria']['id']);
     $c = count($documents);
     if ($c > 0) {
         $this->Session->write('Search.document_ids', $documents);
         $this->Session->write('Search.count', count($documents));
         $msg = 'There ' . ($c > 1 ? ' are ' : ' is ') . $c . ' document' . ($c > 1 ? 's ' : ' ') . 'that satisf' . ($c > 1 ? 'y ' : 'ies ') . 'that term. ';
         $this->Session->setFlash($msg);
         $this->redirect(array('controller' => 'documents', 'action' => 'download'));
     } else {
         $this->Session->setFlash('We\'re sorry. There weren\'t any documents that satisfy that term(s)');
         $this->redirect(array('controller' => 'tags', 'action' => 'index'));
     }
 }