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
fd09783c
Commit
fd09783c
authored
Dec 10, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use full names for search parameters
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
564d5c67
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
32 deletions
+32
-32
weblate/trans/forms.py
weblate/trans/forms.py
+13
-13
weblate/trans/models/unit.py
weblate/trans/models/unit.py
+7
-7
weblate/trans/search.py
weblate/trans/search.py
+12
-12
No files found.
weblate/trans/forms.py
View file @
fd09783c
...
...
@@ -410,27 +410,27 @@ class SearchForm(forms.Form):
),
initial
=
False
)
s
rc
=
forms
.
BooleanField
(
s
ource
=
forms
.
BooleanField
(
label
=
_
(
'Search in source strings'
),
required
=
False
,
initial
=
True
)
t
g
t
=
forms
.
BooleanField
(
t
arge
t
=
forms
.
BooleanField
(
label
=
_
(
'Search in target strings'
),
required
=
False
,
initial
=
True
)
c
tx
=
forms
.
BooleanField
(
c
ontext
=
forms
.
BooleanField
(
label
=
_
(
'Search in context strings'
),
required
=
False
,
initial
=
False
)
loc
=
forms
.
BooleanField
(
loc
ation
=
forms
.
BooleanField
(
label
=
_
(
'Search in location strings'
),
required
=
False
,
initial
=
False
)
c
m
t
=
forms
.
BooleanField
(
c
ommen
t
=
forms
.
BooleanField
(
label
=
_
(
'Search in comment strings'
),
required
=
False
,
initial
=
False
...
...
@@ -471,13 +471,13 @@ class SearchForm(forms.Form):
cleaned_data
[
'type'
]
=
'all'
# Default to source and target search
if
(
not
cleaned_data
[
's
rc
'
]
and
not
cleaned_data
[
't
g
t'
]
and
not
cleaned_data
[
'loc'
]
and
not
cleaned_data
[
'c
m
t'
]
and
not
cleaned_data
[
'c
tx
'
]):
cleaned_data
[
's
rc
'
]
=
True
cleaned_data
[
't
g
t'
]
=
True
if
(
not
cleaned_data
[
's
ource
'
]
and
not
cleaned_data
[
't
arge
t'
]
and
not
cleaned_data
[
'loc
ation
'
]
and
not
cleaned_data
[
'c
ommen
t'
]
and
not
cleaned_data
[
'c
ontext
'
]):
cleaned_data
[
's
ource
'
]
=
True
cleaned_data
[
't
arge
t'
]
=
True
return
cleaned_data
...
...
@@ -490,7 +490,7 @@ class SearchForm(forms.Form):
if
self
.
cleaned_data
[
'q'
]:
query
[
'q'
]
=
self
.
cleaned_data
[
'q'
].
encode
(
'utf-8'
)
query
[
'search'
]
=
self
.
cleaned_data
[
'search'
]
for
param
in
(
's
rc'
,
'tgt'
,
'ctx'
,
'cmt'
,
'loc
'
):
for
param
in
(
's
ource'
,
'target'
,
'context'
,
'comment'
,
'location
'
):
if
self
.
cleaned_data
[
param
]:
query
[
param
]
=
'on'
...
...
weblate/trans/models/unit.py
View file @
fd09783c
...
...
@@ -208,15 +208,15 @@ class UnitManager(models.Manager):
else
:
modifier
=
'__icontains'
if
params
[
's
rc
'
]:
if
params
[
's
ource
'
]:
queries
.
append
(
'source'
)
if
params
[
't
g
t'
]:
if
params
[
't
arge
t'
]:
queries
.
append
(
'target'
)
if
params
[
'c
tx
'
]:
if
params
[
'c
ontext
'
]:
queries
.
append
(
'context'
)
if
params
[
'loc'
]:
if
params
[
'loc
ation
'
]:
queries
.
append
(
'location'
)
if
params
[
'c
m
t'
]:
if
params
[
'c
ommen
t'
]:
queries
.
append
(
'comment'
)
query
=
reduce
(
...
...
@@ -244,7 +244,7 @@ class UnitManager(models.Manager):
checksums
=
fulltext_search
(
unit
.
get_source_plurals
()[
0
],
unit
.
translation
.
language
.
code
,
{
's
rc
'
:
True
}
{
's
ource
'
:
True
}
)
return
self
.
filter
(
...
...
@@ -264,7 +264,7 @@ class UnitManager(models.Manager):
same_results
=
fulltext_search
(
unit
.
get_source_plurals
()[
0
],
unit
.
translation
.
language
.
code
,
{
's
rc
'
:
True
}
{
's
ource
'
:
True
}
)
checksums
=
more_results
-
same_results
...
...
weblate/trans/search.py
View file @
fd09783c
...
...
@@ -220,38 +220,38 @@ def fulltext_search(query, lang, params):
checksums
=
set
()
search
=
{
's
rc
'
:
False
,
'c
tx
'
:
False
,
't
g
t'
:
False
,
'c
m
t'
:
False
,
'loc'
:
False
,
's
ource
'
:
False
,
'c
ontext
'
:
False
,
't
arge
t'
:
False
,
'c
ommen
t'
:
False
,
'loc
ation
'
:
False
,
}
search
.
update
(
params
)
if
search
[
's
rc'
]
or
search
[
'ctx'
]
or
search
[
'loc
'
]:
if
search
[
's
ource'
]
or
search
[
'context'
]
or
search
[
'location
'
]:
index
=
get_source_index
()
with
index
.
searcher
()
as
searcher
:
if
search
[
's
rc
'
]:
if
search
[
's
ource
'
]:
checksums
.
update
(
base_search
(
searcher
,
'source'
,
SourceSchema
(),
query
)
)
if
search
[
'c
tx
'
]:
if
search
[
'c
ontext
'
]:
checksums
.
update
(
base_search
(
searcher
,
'context'
,
SourceSchema
(),
query
)
)
if
search
[
'loc'
]:
if
search
[
'loc
ation
'
]:
checksums
.
update
(
base_search
(
searcher
,
'location'
,
SourceSchema
(),
query
)
)
if
search
[
't
gt'
]
or
search
[
'cm
t'
]:
if
search
[
't
arget'
]
or
search
[
'commen
t'
]:
index
=
get_target_index
(
lang
)
with
index
.
searcher
()
as
searcher
:
if
search
[
't
g
t'
]:
if
search
[
't
arge
t'
]:
checksums
.
update
(
base_search
(
searcher
,
'target'
,
TargetSchema
(),
query
)
)
if
search
[
'c
m
t'
]:
if
search
[
'c
ommen
t'
]:
checksums
.
update
(
base_search
(
searcher
,
'comment'
,
TargetSchema
(),
query
)
)
...
...
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