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
5db9415c
Commit
5db9415c
authored
Mar 19, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transparently create per language indices
parent
0faf71dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
trans/search.py
trans/search.py
+9
-6
No files found.
trans/search.py
View file @
5db9415c
...
...
@@ -22,14 +22,14 @@ class SourceSchema(SchemaClass):
translation
=
NUMERIC
def
create_source_index
():
ix_source
=
index
.
create_in
(
return
index
.
create_in
(
settings
.
WHOOSH_INDEX
,
schema
=
SourceSchema
,
indexname
=
'source'
)
def
create_target_index
(
lang
):
ix_target
=
index
.
create_in
(
return
index
.
create_in
(
settings
.
WHOOSH_INDEX
,
schema
=
TargetSchema
,
indexname
=
'target-%s'
%
lang
...
...
@@ -54,10 +54,13 @@ def get_target_index(lang):
if
not
hasattr
(
get_target_index
,
'ix_target'
):
get_target_index
.
ix_target
=
{}
if
not
lang
in
get_target_index
.
ix_target
:
get_target_index
.
ix_target
[
lang
]
=
index
.
open_dir
(
settings
.
WHOOSH_INDEX
,
indexname
=
'target-%s'
%
lang
)
try
:
get_target_index
.
ix_target
[
lang
]
=
index
.
open_dir
(
settings
.
WHOOSH_INDEX
,
indexname
=
'target-%s'
%
lang
)
except
whoosh
.
index
.
EmptyIndexError
:
get_target_index
.
ix_target
[
lang
]
=
create_target_index
(
lang
)
return
get_target_index
.
ix_target
[
lang
]
def
get_source_writer
(
buffered
=
True
):
...
...
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