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
bb82dda2
Commit
bb82dda2
authored
Jul 31, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Methods for getting index
parent
19b7a861
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
trans/search.py
trans/search.py
+20
-1
No files found.
trans/search.py
View file @
bb82dda2
...
...
@@ -29,7 +29,7 @@ from whoosh.filedb.filestore import FileStorage
from
django.db.models.signals
import
post_syncdb
from
weblate
import
appsettings
from
whoosh.index
import
create_in
,
open_dir
from
whoosh.writing
import
AsyncWriter
from
whoosh.writing
import
AsyncWriter
,
BufferedWriter
from
django.dispatch
import
receiver
from
lang.models
import
Language
...
...
@@ -90,6 +90,25 @@ def update_target_unit_index(writer, unit):
)
def
get_source_index
():
'''
Returns source index object.
'''
if
not
STORAGE
.
index_exists
(
'source'
):
create_source_index
()
return
STORAGE
.
open_index
(
'source'
)
def
get_target_index
(
lang
):
'''
Returns target index object.
'''
name
=
'target-%s'
%
lang
if
not
STORAGE
.
index_exists
(
name
):
create_target_index
(
lang
)
return
STORAGE
.
open_index
(
name
)
def
update_index
(
units
,
source_units
=
None
):
'''
Updates fulltext index for given set of units.
...
...
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