Skip to content

Commit

Permalink
Rename vector to pgvector on client side (#23286)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshenlim committed Apr 26, 2024
1 parent c304ce5 commit b48b6e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,3 @@ export const HIDDEN_EXTENSIONS = [
'xml2',
'pg_tle',
]

export const SEARCH_TERMS: Record<string, string[]> = {
vector: ['pgvector', 'pg_vector'],
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useDatabaseExtensionsQuery } from 'data/database-extensions/database-ex
import { useCheckPermissions, usePermissionsLoaded } from 'hooks'
import ExtensionCard from './ExtensionCard'
import ExtensionCardSkeleton from './ExtensionCardSkeleton'
import { HIDDEN_EXTENSIONS, SEARCH_TERMS } from './Extensions.constants'
import { HIDDEN_EXTENSIONS } from './Extensions.constants'

const Extensions = () => {
const { filter } = useParams()
Expand All @@ -25,16 +25,17 @@ const Extensions = () => {
connectionString: project?.connectionString,
})

const formattedExtensions = (data ?? []).map((ext) => {
if (ext.name === 'vector') return { ...ext, name: 'pgvector' }
else return ext
})

const extensions =
filterString.length === 0
? data ?? []
: (data ?? []).filter((ext) => {
const nameMatchesSearch = ext.name.toLowerCase().includes(filterString.toLowerCase())
const searchTermsMatchesSearch = (SEARCH_TERMS[ext.name] || []).some((x) =>
x.includes(filterString.toLowerCase())
)
return nameMatchesSearch || searchTermsMatchesSearch
})
? formattedExtensions
: formattedExtensions.filter((ext) =>
ext.name.toLowerCase().includes(filterString.toLowerCase())
)
const extensionsWithoutHidden = extensions.filter((ext) => !HIDDEN_EXTENSIONS.includes(ext.name))
const [enabledExtensions, disabledExtensions] = partition(
extensionsWithoutHidden,
Expand Down

0 comments on commit b48b6e2

Please sign in to comment.