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

Add working examples of full-text-search of SQLite3 #309

Merged
merged 11 commits into from
Sep 27, 2023

Conversation

KEINOS
Copy link
Contributor

@KEINOS KEINOS commented Sep 26, 2023

This PR is a part of #299 which is an example of using Kagome as a tokenizer for full-text-search, a.k.a. FTS4, of SQLite3.

@ikawaha
Copy link
Owner

ikawaha commented Sep 26, 2023

sugoi!

@KEINOS
Copy link
Contributor Author

KEINOS commented Sep 26, 2023

F.Y.I.

This PR was inspired while reading the below book by @mattn san.

  • p.372, 9.2 "データーベース登録プログラム", "Go言語プログラミングエッセンス エンジニア選書"

@KEINOS
Copy link
Contributor Author

KEINOS commented Sep 26, 2023

I just noticed that the below two query at line 76 and 77 in main.go, the column name words and content should be in reverse for the usage.

_, err = db.Exec(`
		CREATE TABLE IF NOT EXISTS contents_fts(docid INTEGER PRIMARY KEY AUTOINCREMENT, words TEXT);
		CREATE VIRTUAL TABLE IF NOT EXISTS fts USING fts4(content, tokenize=unicode61 "remove_diacritics=2");
	`)

I will 追いPush the changes.

@KEINOS
Copy link
Contributor Author

KEINOS commented Sep 26, 2023

Done!

@ikawaha Plz review it when you got free time.

@mattn
Copy link
Contributor

mattn commented Sep 26, 2023

sugoi!

@ikawaha ikawaha changed the base branch from v2 to develop September 26, 2023 22:59
@ikawaha ikawaha changed the base branch from develop to v2 September 26, 2023 23:00
@ikawaha ikawaha changed the base branch from v2 to develop September 26, 2023 23:00
@KEINOS
Copy link
Contributor Author

KEINOS commented Sep 27, 2023

@ikawaha Sorry, I should've PRed to the develop branch. Won't happen again. 🙏

@ikawaha
Copy link
Owner

ikawaha commented Sep 27, 2023

@KEINOS Never mind, I just forgot to create a develop branch :p.
PRs are always welcome!

@ikawaha
Copy link
Owner

ikawaha commented Sep 27, 2023

@KEINOS LGTM 👍

It would be better if the example sentences were easy to understand the results of morphological analysis. Please review the PR for KEINOS#3 and merge if you would like.

@ikawaha ikawaha self-requested a review September 27, 2023 05:08
chore: Sample sentences are replaced by sentences with easily understandable morphological analysis results.
chore: Added an example of a missing search target.
@KEINOS
Copy link
Contributor Author

KEINOS commented Sep 27, 2023

@ikawaha

I merged your PR, thank you!

Indeed, it got way better to understand about the analysis. I added some other search words to clarify more. Please merge if it LGTY!

@ikawaha ikawaha changed the base branch from develop to master September 27, 2023 11:51
@ikawaha ikawaha changed the base branch from master to v2 September 27, 2023 11:51
@ikawaha ikawaha merged commit 53a6ae4 into ikawaha:v2 Sep 27, 2023
5 checks passed
@ikawaha
Copy link
Owner

ikawaha commented Sep 27, 2023

Thank you!

@KEINOS KEINOS deleted the feat-example-db-search branch September 28, 2023 01:02
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.

3 participants