From 4b79db72bfc6c8be9f937d6d9ef7999c86d9b93a Mon Sep 17 00:00:00 2001 From: BubbleCal Date: Wed, 11 Sep 2024 10:18:29 +0800 Subject: [PATCH] docs: improve the docs and API param name (#1629) Signed-off-by: BubbleCal --- docs/src/fts.md | 2 +- nodejs/__test__/table.test.ts | 2 +- nodejs/lancedb/indices.ts | 4 ++-- python/python/lancedb/table.py | 2 +- python/python/tests/test_fts.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/src/fts.md b/docs/src/fts.md index 37983f3d..63a07723 100644 --- a/docs/src/fts.md +++ b/docs/src/fts.md @@ -205,7 +205,7 @@ table.create_fts_index(["text_field"], use_tantivy=True, ordering_field_names=[" ## Phrase queries vs. terms queries !!! warning "Warn" - Lance-based FTS doesn't support queries combining by boolean operators `OR`, `AND`. + Lance-based FTS doesn't support queries using boolean operators `OR`, `AND`. For full-text search you can specify either a **phrase** query like `"the old man and the sea"`, or a **terms** search query like `"(Old AND Man) AND Sea"`. For more details on the terms diff --git a/nodejs/__test__/table.test.ts b/nodejs/__test__/table.test.ts index 31743be9..66dbbc5c 100644 --- a/nodejs/__test__/table.test.ts +++ b/nodejs/__test__/table.test.ts @@ -872,7 +872,7 @@ describe.each([arrow13, arrow14, arrow15, arrow16, arrow17])( ]; const table = await db.createTable("test", data); await table.createIndex("text", { - config: Index.fts({ withPositions: false }), + config: Index.fts({ withPosition: false }), }); const results = await table.search("hello").toArray(); diff --git a/nodejs/lancedb/indices.ts b/nodejs/lancedb/indices.ts index 5b3b9225..601d719d 100644 --- a/nodejs/lancedb/indices.ts +++ b/nodejs/lancedb/indices.ts @@ -142,7 +142,7 @@ export interface FtsOptions { * If set to false, the index will not store the positions of the tokens in the text, * which will make the index smaller and faster to build, but will not support phrase queries. */ - withPositions?: boolean; + withPosition?: boolean; } export class Index { @@ -244,7 +244,7 @@ export class Index { * For now, the full text search index only supports English, and doesn't support phrase search. */ static fts(options?: Partial) { - return new Index(LanceDbIndex.fts(options?.withPositions)); + return new Index(LanceDbIndex.fts(options?.withPosition)); } /** diff --git a/python/python/lancedb/table.py b/python/python/lancedb/table.py index ec9f652e..6eabd0a7 100644 --- a/python/python/lancedb/table.py +++ b/python/python/lancedb/table.py @@ -505,7 +505,7 @@ class Table(ABC): Only available with use_tantivy=False If False, do not store the positions of the terms in the text. This can reduce the size of the index and improve indexing speed. - But it will not be possible to use phrase queries. + But it will raise an exception for phrase queries. """ raise NotImplementedError diff --git a/python/python/tests/test_fts.py b/python/python/tests/test_fts.py index ade569ac..ce649581 100644 --- a/python/python/tests/test_fts.py +++ b/python/python/tests/test_fts.py @@ -143,7 +143,7 @@ def test_create_index_with_stemming(tmp_path, table): @pytest.mark.parametrize("with_position", [True, False]) def test_create_inverted_index(table, use_tantivy, with_position): if use_tantivy and not with_position: - pytest.skip("we don't support to build tantivy index without position") + pytest.skip("we don't support building a tantivy index without position") table.create_fts_index("text", use_tantivy=use_tantivy, with_position=with_position)