Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
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
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos
Commits
1912c20d
Commit
1912c20d
authored
Mar 28, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: mroonga stem french
parent
0cbf44e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
software/erp5/test/test/test_mariadb.py
software/erp5/test/test/test_mariadb.py
+43
-0
No files found.
software/erp5/test/test/test_mariadb.py
View file @
1912c20d
...
...
@@ -41,6 +41,10 @@ from . import ERP5InstanceTestCase
from
.
import
setUpModule
setUpModule
# pyflakes
def
setUpModule
():
import
logging
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
class
MariaDBTestCase
(
ERP5InstanceTestCase
):
"""Base test case for mariadb tests.
...
...
@@ -227,3 +231,42 @@ 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
))))
del
TestMariaDB
\ No newline at end of file
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