MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / search

Method search

web/pgadmin/tools/search_objects/utils.py:112–152  ·  view source on GitHub ↗
(self, text, obj_type=None)

Source from the content-addressed store, hash-verified

110 return skip_obj_type
111
112 def search(self, text, obj_type=None):
113 skip_obj_type = []
114 conn = self.manager.connection(did=self.did)
115 last_system_oid = DATABASE_LAST_SYSTEM_OID
116
117 show_node_prefs = self.get_show_node_prefs()
118 node_labels = self.get_supported_types(skip_check=True)
119 # escape the single quote from search text
120 text = text.replace("'", "''")
121 skip_obj_type = self._check_permission(obj_type, conn,
122 skip_obj_type)
123
124 # Column catalog_level has values as
125 # N - Not a catalog schema
126 # D - Catalog schema with DB support - pg_catalog
127 # O - Catalog schema with object support only - info schema, sys
128 status, res = conn.execute_dict(
129 self.get_sql('search.sql',
130 search_text=text.lower(), obj_type=obj_type,
131 show_system_objects=self.show_system_objects,
132 show_node_prefs=show_node_prefs, _=gettext,
133 last_system_oid=last_system_oid,
134 skip_obj_type=skip_obj_type)
135 )
136
137 if not status:
138 return status, res
139
140 ret_val = [
141 {
142 'name': row['obj_name'],
143 'type': row['obj_type'],
144 'type_label': node_labels[row['obj_type']],
145 'path': row['obj_path'],
146 'show_node': row['show_node'],
147 'other_info': row['other_info'],
148 'catalog_level': row['catalog_level'],
149 }
150 for row in res['rows']
151 ]
152 return True, ret_val

Callers 15

searchFunction · 0.95
runTestMethod · 0.95
parse_rst_release_noteFunction · 0.80
onFailureFunction · 0.80
_set_seclabelsMethod · 0.80
parse_sec_labels_from_dbFunction · 0.80
_fetch_propertiesMethod · 0.80
sqlMethod · 0.80
onFailureFunction · 0.80
runTestMethod · 0.80
_formatterMethod · 0.80

Calls 6

get_show_node_prefsMethod · 0.95
get_supported_typesMethod · 0.95
_check_permissionMethod · 0.95
get_sqlMethod · 0.95
connectionMethod · 0.80
execute_dictMethod · 0.45

Tested by 7

runTestMethod · 0.76
runTestMethod · 0.64
runTestMethod · 0.64
runTestMethod · 0.64
runTestMethod · 0.64
fetch_csrfMethod · 0.64