فهرست منبع

Only return search matches once, fixes #1801

Jordi Boggiano 12 سال پیش
والد
کامیت
3a612dca01
1فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 4 3
      src/Composer/Repository/ArrayRepository.php

+ 4 - 3
src/Composer/Repository/ArrayRepository.php

@@ -83,10 +83,11 @@ class ArrayRepository implements RepositoryInterface
 
         $matches = array();
         foreach ($this->getPackages() as $package) {
+            $name = $package->getName();
             // TODO implement SEARCH_FULLTEXT handling with keywords/description matching
-            if (preg_match($regex, $package->getName())) {
-                $matches[] = array(
-                    'name' => $package->getName(),
+            if (!isset($matches[$name]) && preg_match($regex, $name)) {
+                $matches[$name] = array(
+                    'name' => $package->getPrettyName(),
                     'description' => $package->getDescription(),
                 );
             }