Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
28fbad38
Commit
28fbad38
authored
Feb 21, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move flushing code to search module
parent
ab18292c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
trans/search.py
trans/search.py
+9
-0
trans/tests/commands.py
trans/tests/commands.py
+4
-8
No files found.
trans/search.py
View file @
28fbad38
...
...
@@ -67,6 +67,15 @@ def create_index(sender=None, **kwargs):
create_source_index
()
def
flush_index
():
'''
Flushes any possibly buffered writes to index.
'''
FULLTEXT_INDEX
.
_source_writer
.
commit
()
for
lang
in
FULLTEXT_INDEX
.
_target_writer
:
FULLTEXT_INDEX
.
_target_writer
[
lang
].
commit
()
def
update_index
(
units
,
source_units
=
None
):
'''
Updates fulltext index for given set of units.
...
...
trans/tests/commands.py
View file @
28fbad38
...
...
@@ -24,7 +24,7 @@ Tests for management commands.
from
trans.tests.models
import
RepoTestCase
from
django.core.management
import
call_command
from
trans.search
import
FULLTEXT_INDEX
from
trans.search
import
flush_index
class
ImportProjectTest
(
RepoTestCase
):
...
...
@@ -117,10 +117,8 @@ class PeriodicTest(RepoTestCase):
def
test_update_index
(
self
):
# Flush possible caches
FULLTEXT_INDEX
.
_source_writer
.
commit
()
for
lang
in
FULLTEXT_INDEX
.
_target_writer
:
FULLTEXT_INDEX
.
_target_writer
[
lang
].
commit
()
flush_index
()
# Test the command
call_command
(
'update_index'
)
...
...
@@ -200,9 +198,7 @@ class RebuildIndexTest(CheckGitTest):
def
setUp
(
self
):
super
(
RebuildIndexTest
,
self
).
setUp
()
# Flush possible caches
FULLTEXT_INDEX
.
_source_writer
.
commit
()
for
lang
in
FULLTEXT_INDEX
.
_target_writer
:
FULLTEXT_INDEX
.
_target_writer
[
lang
].
commit
()
flush_index
()
def
test_all_clean
(
self
):
self
.
do_test
(
...
...
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