/** * 全匹配数据 * TODO allow setting result number * * @param Cheque $cheque * @return array */ public function find(Cheque $cheque) { $strategies = $cheque->getSearchKey(); $returnList = []; // 合并策略组 foreach ($strategies as $strategy) { $keyList = $this->client->keys($strategy); foreach ($keyList as $keyString) { $returnList += [$keyString => $this->client->get($keyString)]; } } return $returnList; }
/** * 查找匹配内容 * * @param $word * @return array */ public function withdrawal($word, $type) { $accounts = $this->store->find(Cheque::parse($word, $type)); $words = Analyze::sort($word, $accounts); return array_slice($words, 0, 10); }