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
5314a216
Commit
5314a216
authored
Aug 05, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add management command to optimize fulltext index.
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
22bb357f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
docs/admin/management.rst
docs/admin/management.rst
+4
-0
docs/changes.rst
docs/changes.rst
+1
-0
weblate/trans/management/commands/rebuild_index.py
weblate/trans/management/commands/rebuild_index.py
+17
-0
No files found.
docs/admin/management.rst
View file @
5314a216
...
...
@@ -238,6 +238,10 @@ have huge set of translation units.
You can use ``--clean`` to remove all words from database prior updating.
With ``--optimize`` the index will not be processed again, only it's content
will be optimized (removing stale entries and merging possibly split index
files).
.. seealso:: :ref:`fulltext`
update_index
...
...
docs/changes.rst
View file @
5314a216
...
...
@@ -16,6 +16,7 @@ Released on ? 2015.
* Several URLs have changed, you might have to update your bookmarks.
* Hook scripts are executed with VCS root as current directory.
* Hook scripts are executed with environment variables descriping current component.
* Add management command to optimize fulltext index.
weblate 2.3
-----------
...
...
weblate/trans/management/commands/rebuild_index.py
View file @
5314a216
...
...
@@ -24,6 +24,7 @@ from weblate.trans.search import (
update_source_unit_index
,
update_target_unit_index
,
clean_indexes
,
)
from
weblate.lang.models
import
Language
from
optparse
import
make_option
...
...
@@ -37,9 +38,25 @@ class Command(WeblateCommand):
default
=
False
,
help
=
'removes also all words from database'
),
make_option
(
'--optimize'
,
action
=
'store_true'
,
dest
=
'optimize'
,
default
=
False
,
help
=
'optimize index without rebuilding it'
),
)
def
handle
(
self
,
*
args
,
**
options
):
# Optimize index
if
options
[
'optimize'
]:
index
=
get_source_index
()
index
.
optimize
()
languages
=
Language
.
objects
.
have_translation
()
for
lang
in
languages
:
index
=
get_target_index
(
lang
.
code
)
index
.
optimize
()
return
# Optionally rebuild indices from scratch
if
options
[
'clean'
]:
clean_indexes
()
...
...
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