function topic_interest_map() { global $Me; if ($this->topic_interest_map_ !== null) { return $this->topic_interest_map_; } if ($this->contactId <= 0) { return array(); } if ($this->roles & self::ROLE_PCLIKE && $this !== $Me && ($pcm = pcMembers()) && $this === get($pcm, $this->contactId)) { $result = Dbl::qe("select contactId, topicId, interest from TopicInterest where interest!=0 order by contactId"); foreach ($pcm as $pc) { $pc->topic_interest_map_ = array(); } $pc = null; while ($row = edb_row($result)) { if (!$pc || $pc->contactId != $row[0]) { $pc = get($pcm, $row[0]); } if ($pc) { $pc->topic_interest_map_[(int) $row[1]] = (int) $row[2]; } } Dbl::free($result); } else { $result = Dbl::qe("select topicId, interest from TopicInterest where contactId={$this->contactId} and interest!=0"); $this->topic_interest_map_ = Dbl::fetch_iimap($result); } return $this->topic_interest_map_; }
private function _clauseTermCheckWordCount($t, $row, $rrow) { if ($this->_reviewWordCounts === false) { $this->_reviewWordCounts = Dbl::fetch_iimap("select reviewId, reviewWordCount from PaperReview"); } if (!isset($this->_reviewWordCounts[$rrow->reviewId])) { $cid2rid = $row->all_review_ids(); foreach ($row->all_review_word_counts($row) as $cid => $rwc) { $this->_reviewWordCounts[$cid2rid[$cid]] = $rwc; } } return $t->value->wordcountexpr->test($this->_reviewWordCounts[$rrow->reviewId]); }