Exemple #1
0
 /**
  * Calculate all string permutations of the original string
  * @param int $min
  * @return array
  */
 public function permutations(int $min = 1) : array
 {
     // If the minimum index length is longer than the length of
     // the term then this is a noop
     if ($min > strlen($this->term)) {
         return [];
     }
     return Str::permutations($this->term, $min);
 }
 /**
  * Find all IDs that match a search under a namespace
  * @param  string $term
  * @param  string $namespace
  * @return array
  */
 public function find(string $term, string $namespace) : array
 {
     $namespaced = $this->data[$namespace] ?? [];
     return $namespaced[Str::clean($term)] ?? [];
 }
 /**
  * Find all IDs that match a search under a namespace
  * @param  string $term
  * @param  string $namespace
  * @return array
  */
 public function find(string $term, string $namespace) : array
 {
     $term = Str::clean($term);
     return $this->redis->smembers("autocomplete:{$term}:{$namespace}");
 }