Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(python): add phrase query option for fts #798

Merged
merged 2 commits into from
Jan 10, 2024

Conversation

changhiskhan
Copy link
Contributor

addresses #797

Problem: tantivy does not expose option to explicitly

Proposed solution here:

  1. Add a .phrase_query() option
  2. Under the hood, LanceDB takes care of wrapping the input in quotes and replace nested double quotes with single quotes

I've also filed an upstream issue, if they support phrase queries natively then we can get rid of our manual custom processing here.

Copy link
Contributor

@westonpace westonpace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question

row_ids, scores = search_index(index, self._query, self._limit)
query = self._query
if self._phrase_query:
query = query.replace('"', "'")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to worry about escaped double quotes at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i added a test case with escaped double quotes. It does not cause a syntax error in this case

@changhiskhan changhiskhan merged commit 63411b4 into main Jan 10, 2024
11 checks passed
@changhiskhan changhiskhan deleted the changhiskhan/phrase-query branch January 10, 2024 03:41
koolamusic pushed a commit to tecmie/lancedb that referenced this pull request Jan 12, 2024
addresses lancedb#797 

Problem: tantivy does not expose option to explicitly

Proposed solution here: 

1. Add a `.phrase_query()` option
2. Under the hood, LanceDB takes care of wrapping the input in quotes
and replace nested double quotes with single quotes

I've also filed an upstream issue, if they support phrase queries
natively then we can get rid of our manual custom processing here.
raghavdixit99 pushed a commit to raghavdixit99/lancedb that referenced this pull request Apr 5, 2024
addresses lancedb#797 

Problem: tantivy does not expose option to explicitly

Proposed solution here: 

1. Add a `.phrase_query()` option
2. Under the hood, LanceDB takes care of wrapping the input in quotes
and replace nested double quotes with single quotes

I've also filed an upstream issue, if they support phrase queries
natively then we can get rid of our manual custom processing here.
raghavdixit99 pushed a commit to raghavdixit99/lancedb that referenced this pull request Apr 5, 2024
addresses lancedb#797 

Problem: tantivy does not expose option to explicitly

Proposed solution here: 

1. Add a `.phrase_query()` option
2. Under the hood, LanceDB takes care of wrapping the input in quotes
and replace nested double quotes with single quotes

I've also filed an upstream issue, if they support phrase queries
natively then we can get rid of our manual custom processing here.
westonpace pushed a commit that referenced this pull request Apr 5, 2024
addresses #797 

Problem: tantivy does not expose option to explicitly

Proposed solution here: 

1. Add a `.phrase_query()` option
2. Under the hood, LanceDB takes care of wrapping the input in quotes
and replace nested double quotes with single quotes

I've also filed an upstream issue, if they support phrase queries
natively then we can get rid of our manual custom processing here.
westonpace pushed a commit that referenced this pull request Apr 5, 2024
addresses #797 

Problem: tantivy does not expose option to explicitly

Proposed solution here: 

1. Add a `.phrase_query()` option
2. Under the hood, LanceDB takes care of wrapping the input in quotes
and replace nested double quotes with single quotes

I've also filed an upstream issue, if they support phrase queries
natively then we can get rid of our manual custom processing here.
alexkohler pushed a commit to alexkohler/lancedb that referenced this pull request Apr 20, 2024

Co-authored-by: Will Jones <willjones127@gmail.com>

---------

Co-authored-by: Will Jones <willjones127@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants