fix: clearer error that FTS is not supported on object stores (#1273)

Closes #1272
This commit is contained in:
Will Jones
2024-05-07 10:15:53 -07:00
committed by GitHub
parent becd649130
commit 75ede86fab
2 changed files with 15 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ from typing import (
import deprecation
import numpy as np
import pyarrow as pa
import pyarrow.fs as pa_fs
import pydantic
from . import __version__
@@ -37,7 +38,7 @@ from .arrow import AsyncRecordBatchReader
from .common import VEC
from .rerankers.base import Reranker
from .rerankers.linear_combination import LinearCombinationReranker
from .util import safe_import_pandas
from .util import fs_from_uri, safe_import_pandas
if TYPE_CHECKING:
import PIL
@@ -665,6 +666,14 @@ class LanceFtsQueryBuilder(LanceQueryBuilder):
# get the index path
index_path = self._table._get_fts_index_path()
# Check that we are on local filesystem
fs, _path = fs_from_uri(index_path)
if not isinstance(fs, pa_fs.LocalFileSystem):
raise NotImplementedError(
"Full-text search is only supported on the local filesystem"
)
# check if the index exist
if not Path(index_path).exists():
raise FileNotFoundError(

View File

@@ -1209,6 +1209,11 @@ class LanceTable(Table):
raise ValueError("Index already exists. Use replace=True to overwrite.")
fs.delete_dir(path)
if not isinstance(fs, pa_fs.LocalFileSystem):
raise NotImplementedError(
"Full-text search is only supported on the local filesystem"
)
index = create_index(
self._get_fts_index_path(),
field_names,