diff --git a/product/ZSQLCatalog/Query/EntireQuery.py b/product/ZSQLCatalog/Query/EntireQuery.py
index 3cdc41839fe78bcf0df19d921923e181dd7ea71b..6e8d4777a4476b1b1772f81a67fb58bce741a507 100644
--- a/product/ZSQLCatalog/Query/EntireQuery.py
+++ b/product/ZSQLCatalog/Query/EntireQuery.py
@@ -68,7 +68,7 @@ class EntireQuery(object):
     self.from_expression = from_expression
 
   def asSearchTextExpression(self, sql_catalog):
-    return query.asSearchTextExpression(sql_catalog)
+    return self.query.asSearchTextExpression(sql_catalog)
 
   @profiler_decorator
   def asSQLExpression(self, sql_catalog, only_group_columns):