Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Xueyun Qian
erp5
Commits
3438bad5
Commit
3438bad5
authored
Apr 09, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only index a property in full text if document has the property
parent
083357b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
product/ERP5OOo/tests/testDms.py
product/ERP5OOo/tests/testDms.py
+13
-0
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+6
-3
No files found.
product/ERP5OOo/tests/testDms.py
View file @
3438bad5
...
...
@@ -892,6 +892,19 @@ class TestDocument(TestDocumentMixin):
web_page
.
getReference
(),
web_page
.
getLanguage
(),
web_page
.
getVersion
())))
document
=
portal
.
document_module
.
newContent
(
portal_type
=
'Presentation'
,)
# searchable text is empty by default
self
.
assertEquals
(
''
,
document
.
SearchableText
())
# it contains title
document
.
setTitle
(
'foo'
)
self
.
assertEquals
(
'foo'
,
document
.
SearchableText
())
# and description
document
.
setDescription
(
'bar'
)
self
.
assertTrue
(
'bar'
in
document
.
SearchableText
(),
document
.
SearchableText
())
def
test_10_SearchString
(
self
):
"""
Test search string search generation and parsing.
...
...
product/ERP5Type/Base.py
View file @
3438bad5
...
...
@@ -3020,10 +3020,13 @@ class Base( CopyContainer,
# so use definition of 'Base Type' for searchable methods & properties
portal_type
=
self
.
portal_types
.
getTypeInfo
(
'Base Type'
)
searchable_text_method_id_list
=
[]
# generated from properties methods and add explicitly defined method_ids as well
for
searchable_text_property_id
in
portal_type
.
getSearchableTextPropertyIdList
():
method_id
=
convertToUpperCase
(
searchable_text_property_id
)
searchable_text_method_id_list
.
extend
([
'get%s'
%
method_id
])
if
self
.
hasProperty
(
searchable_text_property_id
):
method_id
=
convertToUpperCase
(
searchable_text_property_id
)
searchable_text_method_id_list
.
extend
([
'get%s'
%
method_id
])
searchable_text_method_id_list
.
extend
(
portal_type
.
getSearchableTextMethodIdList
())
for
method_id
in
searchable_text_method_id_list
:
# XXX: how to exclude exclude acquisition (not working)
...
...
@@ -3039,7 +3042,7 @@ class Base( CopyContainer,
else
:
searchable_text_list
.
append
(
method_value
)
searchable_text
=
' '
.
join
([
str
(
x
)
for
x
in
searchable_text_list
])
return
searchable_text
return
searchable_text
.
strip
()
# Compatibility with CMF Catalog / CPS sites
SearchableText
=
getSearchableText
...
...
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