Beispiel #1
0
 public function searchDocuments($words, $includeAllDocs)
 {
     $this->checkBtreeIsLoaded();
     if ($this->_btree == null) {
         throw new NotFoundException("BTree is invalid. Try to recreate  the index.", 601);
     } else {
         $arr = BTreeUtil::searchDocuments(strtolower(trim($words)), $this->_btree, $includeAllDocs);
         return $arr;
     }
 }
Beispiel #2
0
 public function saveDocument($documentName, $xml, $btree)
 {
     $btree = BTreeUtil::navigateNodes($xml->documentElement, $documentName . "#/", $btree);
     $documentName = self::getFullFileName($documentName);
     FileUtil::ForceDirectories(self::getPathFromFile($documentName));
     $xml->normalize();
     XmlUtil::SaveXmlDocument($xml, $documentName);
     return $btree;
 }
Beispiel #3
0
 /**
  *@param DOMNode $node
  *@param string $xpath
  *@param BTree $btree
  *@return BTree
  */
 public static function navigateNodes($node, $xpath, $btree)
 {
     if (!is_null($node)) {
         if ($node->nodeType == XML_TEXT_NODE) {
             $btree = BTreeUtil::insertTokens($node->nodeValue, $xpath, $btree);
         }
         if ($node->hasChildNodes()) {
             $btree = self::navigateNodes($node->firstChild, $xpath . $node->nodeName . "/", $btree);
         }
         // Ver se coloco Attributes aqui.... Acho que nao.
         $btree = self::navigateNodes($node->nextSibling, $xpath, $btree);
     }
     return $btree;
 }