Пример #1
0
 /**
  * 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}");
 }
Пример #2
0
 /**
  * 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)] ?? [];
 }
Пример #3
0
 /**
  * Create a new index
  * @param string $id
  * @param string $term
  * @return void
  */
 public function __construct(string $id, string $term)
 {
     $this->id = $id;
     $this->term = Str::clean($term);
 }