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
a8873258
Commit
a8873258
authored
Apr 16, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better name for static variable
parent
97b5c311
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
trans/managers.py
trans/managers.py
+3
-3
trans/search.py
trans/search.py
+4
-4
No files found.
trans/managers.py
View file @
a8873258
...
...
@@ -225,14 +225,14 @@ class UnitManager(models.Manager):
if
source
or
context
:
with
trans
.
search
.
index
.
source_searcher
()
as
searcher
:
if
source
:
ret
=
ret
.
union
(
self
.
__search
(
searcher
,
'source'
,
trans
.
search
.
source_schema
,
query
))
ret
=
ret
.
union
(
self
.
__search
(
searcher
,
'source'
,
trans
.
search
.
SOURCE_SCHEMA
,
query
))
if
context
:
ret
=
ret
.
union
(
self
.
__search
(
searcher
,
'context'
,
trans
.
search
.
source_schema
,
query
))
ret
=
ret
.
union
(
self
.
__search
(
searcher
,
'context'
,
trans
.
search
.
SOURCE_SCHEMA
,
query
))
if
translation
:
sample
=
self
.
all
()[
0
]
with
trans
.
search
.
index
.
target_searcher
(
sample
.
translation
.
language
.
code
)
as
searcher
:
ret
=
ret
.
union
(
self
.
__search
(
searcher
,
'target'
,
trans
.
search
.
target_schema
,
query
))
ret
=
ret
.
union
(
self
.
__search
(
searcher
,
'target'
,
trans
.
search
.
TARGET_SCHEMA
,
query
))
if
checksums
:
return
ret
...
...
trans/search.py
View file @
a8873258
...
...
@@ -10,12 +10,12 @@ from django.conf import settings
from
whoosh.index
import
create_in
,
open_dir
from
whoosh.writing
import
BufferedWriter
target_schema
=
Schema
(
TARGET_SCHEMA
=
Schema
(
checksum
=
ID
(
stored
=
True
,
unique
=
True
),
target
=
TEXT
)
source_schema
=
Schema
(
SOURCE_SCHEMA
=
Schema
(
checksum
=
ID
(
stored
=
True
,
unique
=
True
),
source
=
TEXT
,
context
=
TEXT
...
...
@@ -24,14 +24,14 @@ source_schema = Schema(
def
create_source_index
():
return
create_in
(
settings
.
WHOOSH_INDEX
,
schema
=
source_schema
,
schema
=
SOURCE_SCHEMA
,
indexname
=
'source'
)
def
create_target_index
(
lang
):
return
create_in
(
settings
.
WHOOSH_INDEX
,
schema
=
target_schema
,
schema
=
TARGET_SCHEMA
,
indexname
=
'target-%s'
%
lang
)
...
...
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