diff --git a/db/ActiveSearchTrait.php b/db/ActiveSearchTrait.php
index <HASH>..<HASH> 100644
--- a/db/ActiveSearchTrait.php
+++ b/db/ActiveSearchTrait.php
@@ -183,7 +183,9 @@ trait ActiveSearchTrait
             $subquery = (new Query)
                 ->select(array_keys($relation->link))
                 ->from(['t' => $relationClass::tableName()])
-                ->where(['IN', $relationClass::primaryKey(), $value]);
+                ->where(['IN', array_map(function ($key) {
+                    return 't.' . $key;
+                }, $relationClass::primaryKey()), $value]);
             $linkKeys = array_values($relation->link);
         }
         return ['IN', $linkKeys, $subquery];
fix relation search by adding prefix to pk