File tree Expand file tree Collapse file tree
webapp/redux/dataTableSearch Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66)
77
88
9+ def _get_potential_exact_schema_table_name (keywords ):
10+ """Get the schema and table name from a full table name.
11+
12+ E.g. "default.table_a", will return (default, table_a)
13+ """
14+ dot_index = keywords .find ("." )
15+ if dot_index == - 1 :
16+ return None , keywords
17+
18+ return keywords [:dot_index ], keywords [dot_index + 1 :]
19+
20+
921def _match_table_word_fields (fields ):
1022 search_fields = []
1123 for field in fields :
@@ -44,6 +56,18 @@ def construct_tables_query(
4456):
4557 keywords_query = {}
4658 if keywords :
59+ should_clause = _match_table_phrase_queries (fields , keywords )
60+
61+ table_schema , table_name = _get_potential_exact_schema_table_name (keywords )
62+ if table_schema :
63+ filters .append (["schema" , table_schema ])
64+
65+ # boost score for table name exact match
66+ if table_name :
67+ should_clause .append (
68+ {"term" : {"name" : {"value" : table_name , "boost" : 100 }}},
69+ )
70+
4771 keywords_query = {
4872 "bool" : {
4973 "must" : {
@@ -54,7 +78,7 @@ def construct_tables_query(
5478 "operator" : "and" ,
5579 },
5680 },
57- "should" : _match_table_phrase_queries ( fields , keywords ) ,
81+ "should" : should_clause ,
5882 }
5983 }
6084 else :
Original file line number Diff line number Diff line change @@ -28,11 +28,6 @@ function mapStateToSearch(state: IDataTableSearchState) {
2828 ( [ _ , filterValue ] ) => filterValue != null
2929 ) ;
3030
31- const matchSchemaName = searchString . match ( / ( \w + ) \. ( \w * ) / ) ;
32- if ( matchSchemaName ) {
33- filters . push ( [ 'schema' , matchSchemaName [ 1 ] ] ) ;
34- }
35-
3631 const searchParam = {
3732 metastore_id : state . metastoreId ,
3833 keywords : searchString ,
You can’t perform that action at this time.
0 commit comments