Skip to content

Commit

Permalink
Ignore "misc" stem
Browse files Browse the repository at this point in the history
  • Loading branch information
IgKh committed Nov 7, 2022
1 parent 40e4da6 commit f4832c9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
tag: [9.6-bullseye, 10-bullseye, 11-bullseye, 12-bullseye, 13-bullseye, 14-bullseye]
tag: [9.6-bullseye, 10-bullseye, 11-bullseye, 12-bullseye, 13-bullseye, 14-bullseye, 15-bullseye]

runs-on: ubuntu-latest
container:
Expand Down
6 changes: 6 additions & 0 deletions dict_hspell.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ typedef struct DictHspell
}
DictHspell;

static const unsigned char MISC_STEM[] = {0xF9, 0xE5, 0xF0, 0xE5, 0xFA, 0};

static List* stem_list;

PG_FUNCTION_INFO_V1(dhspell_init);
Expand Down Expand Up @@ -146,6 +148,10 @@ hspell_callback(const char* word, const char* baseword, int preflen, int prefspe
continue;
}

if (memcmp(stem_text, MISC_STEM, sizeof(MISC_STEM)) == 0) {
continue;
}

if (!list_member_ptr(stem_list, stem_text)) {
stem_list = lappend(stem_list, stem_text);
}
Expand Down
6 changes: 6 additions & 0 deletions expected/dict_hspell.out
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ SELECT ts_lexize('hspell', 'איןמילהכזו');
{איןמילהכזו}
(1 row)

SELECT ts_lexize('hspell', 'ישראל');
ts_lexize
-----------
{ישראל}
(1 row)

SELECT ts_lexize('hspell', 'English');
ts_lexize
-----------
Expand Down
1 change: 1 addition & 0 deletions sql/dict_hspell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ CREATE EXTENSION pg_hspell;
SELECT ts_lexize('hspell', 'הרכבת');
SELECT ts_lexize('hspell', 'רק');
SELECT ts_lexize('hspell', 'איןמילהכזו');
SELECT ts_lexize('hspell', 'ישראל');

SELECT ts_lexize('hspell', 'English');
SELECT ts_lexize('hspell', 'Русский');

0 comments on commit f4832c9

Please sign in to comment.