Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ophélie Gagnard
slapos
Commits
f7b0999a
Commit
f7b0999a
authored
Mar 28, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: mroonga stem french
parent
43f21c73
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
software/erp5/test/test/test_mariadb.py
software/erp5/test/test/test_mariadb.py
+37
-0
No files found.
software/erp5/test/test/test_mariadb.py
View file @
f7b0999a
...
...
@@ -267,3 +267,40 @@ class TestMroonga(MariaDBTestCase):
(
2
,
"I'm developing Groonga"
),
(
3
,
"I developed Groonga"
),
],
list
(
sorted
(
cnx
.
store_result
().
fetch_row
(
maxrows
=
4
))))
def
test_mroonga_full_text_stem_french
(
self
):
# example from https://mroonga.org//docs/tutorial/storage.html#how-to-specify-the-token-filters
cnx
=
self
.
getDatabaseConnection
()
with
contextlib
.
closing
(
cnx
):
cnx
.
query
(
"SELECT mroonga_command('register token_filters/stem')"
)
self
.
assertEqual
(((
'true'
,),),
cnx
.
store_result
().
fetch_row
(
maxrows
=
2
))
cnx
.
query
(
r"""
CREATE TABLE memos_french (
id INT NOT NULL PRIMARY KEY,
content TEXT NOT NULL,
FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto", token_filters "\'TokenFilterStem("algorithm", "french")\'" '
) Engine=Mroonga DEFAULT CHARSET=utf8
"""
)
cnx
.
store_result
()
cnx
.
query
(
"""INSERT INTO memos_french VALUES (1, "Nous développons Groonga"), (2, "Je développais Groonga"), (3, "J'ai développé Groonga")"""
)
cnx
.
store_result
()
cnx
.
query
(
"""INSERT INTO memos_french VALUES (4, "Nous maintenons Groonga"), (5, "Je maintiens Groonga"), (6, "J'ai maintenu Groonga")"""
)
cnx
.
store_result
()
cnx
.
query
(
"""
SELECT *
FROM memos_french
WHERE MATCH (content) AGAINST ("+maintenir" IN BOOLEAN MODE)
"""
)
import
pdb
;
pdb
.
set_trace
()
self
.
assertEqual
([
(
1
,
"I develop Groonga"
),
(
2
,
"I'm developing Groonga"
),
(
3
,
"I developed Groonga"
),
],
list
(
sorted
(
cnx
.
store_result
().
fetch_row
(
maxrows
=
4
))))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment