public function getRelated($pid)
 {
     /**
      * Check if we have a reldata obj with same query and if yes return it
      */
     foreach ($this->relDataPool as $key => $value) {
         $missMatch = $value->criticalOptionsMismatch($this->options->getOptions());
         if (empty($missMatch)) {
             $this->relData = $value;
             return $this->relData->getResult();
         }
     }
     // Check if we have relTable in pool
     foreach ($this->relDataPool as $key => $value) {
         if ($value->pid == $pid) {
             $relTable = $value->relTable;
             break;
         }
     }
     // If we couldn't get a relTable search in cache
     if (!isset($relTable)) {
         $relTable = $this->dbActions->getAllOccurrences($pid);
     }
     $criticalOptions = array_intersect_key($this->options->getOptions(), array_flip(erpPRODefaults::$criticalOpts));
     $this->relData = new erpPRORelData($pid, $criticalOptions, $relTable);
     /**
      * If no cached ratings or not the required number of posts
      */
     if (empty($relTable) || count($relTable) < $this->options->getNumberOfPostsToDiplay() || !$this->isPostProcesed($pid, $relTable)) {
         $relTable = $this->doRating($pid);
     }
     /**
      * If reltable is still empty return an empty wp_query obj
      */
     if (empty($relTable)) {
         // Normally this should return an empty wp_query
         return $this->relData->getResult();
     }
     $this->relData->setRelTable($relTable);
     $ratingSystem = erpPRORatingSystem::get_instance($this->relData);
     $weights = $this->calcWeights();
     $ratingSystem->setWeights($weights);
     $ratingSystem->setEntropy($this->options->getEntropy());
     $ratingSystem->formRatingsArrays();
     $ratingSystem->sortRatingsArrays($this->options->getSortRelatedBy(true));
     $postsToExclude = isset($this->wpSession['visited']) ? unserialize($this->wpSession['visited']) : array();
     $slicedArray = $ratingSystem->getSlicedRatingsArrayFlat($this->options->getOffset(), $this->options->getNumberOfPostsToDiplay(), $postsToExclude);
     $qForm = new erpPROQueryFormater();
     $qForm->setMainArgs($pid);
     $qForm->exPostTypes($this->options->getValue('postTypes'));
     $qForm->exCategories($this->options->getValue('categories'));
     $qForm->exTags($this->options->getValue('tags'));
     $qForm->setPostInArg(array_keys($slicedArray));
     $this->relData->setWP_Query($qForm->getArgsArray(), $this->options->getNumberOfPostsToDiplay(), $this->options->getOffset());
     $this->relData->getResult();
     $this->relData->setRatings($slicedArray);
     $this->relData->sortWPQuery(array_keys($slicedArray));
     array_push($this->relDataPool, $this->relData);
     return $this->relData->getResult();
 }