Skip to content

Commit

Permalink
fix: dup table description in table search (pinterest#1216)
Browse files Browse the repository at this point in the history
* fix: dup table description in table search

* hide metastore filter if there is only 1
  • Loading branch information
jczhong84 authored and rohan-sh1 committed Apr 11, 2023
1 parent 7951693 commit 93c2f6f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
4 changes: 2 additions & 2 deletions querybook/server/logic/data_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def get_data_element_by_name(name: str, session=None):


@with_session
def search_data_elements_by_keyword(keyword: str, limit=10, session=None):
def search_data_elements_by_keyword(keyword: str, limit=20, session=None):
return (
session.query(DataElement)
.filter(DataElement.name.like("%" + keyword + "%"))
.filter(DataElement.name.like(keyword + "%"))
.order_by(DataElement.name.asc())
.limit(limit)
.all()
Expand Down
18 changes: 10 additions & 8 deletions querybook/webapp/components/Search/SearchOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,12 @@ export const SearchOverview: React.FC<ISearchOverviewProps> = ({
</>
) : searchType === 'Table' ? (
<>
<div className="search-filter">
<span className="filter-title">Metastore</span>
{metastoreSelectDOM}
</div>
{queryMetastores.length > 1 && (
<div className="search-filter">
<span className="filter-title">Metastore</span>
{metastoreSelectDOM}
</div>
)}
<div className="search-filter">
<span className="filter-title">Top Tier</span>
<div className="result-item-golden horizontal-space-between">
Expand Down Expand Up @@ -727,10 +729,6 @@ export const SearchOverview: React.FC<ISearchOverviewProps> = ({
schema={searchFilters?.schema}
/>
</div>
<div className="search-filter">
<span className="filter-title">Created At</span>
{dateFilterDOM}
</div>
<div className="search-filter">
<span
className="filter-title"
Expand All @@ -755,6 +753,10 @@ export const SearchOverview: React.FC<ISearchOverviewProps> = ({
<span className="filter-title">Search Settings</span>
{searchSettingsDOM}
</div>
<div className="search-filter">
<span className="filter-title">Created At</span>
{dateFilterDOM}
</div>
</>
) : (
<>
Expand Down
5 changes: 0 additions & 5 deletions querybook/webapp/components/Search/SearchResultItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,6 @@ export const DataTableItem: React.FunctionComponent<IDataTableItemProps> = ({
{descriptionDOM}
</span>
</Level>
<Level className="result-items-bottom">
<span className="result-item-description">
{descriptionDOM}
</span>
</Level>
</div>
</div>
<UrlContextMenu url={url} anchorRef={selfRef} />
Expand Down

0 comments on commit 93c2f6f

Please sign in to comment.