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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
erp5
Commits
7d413fbd
Commit
7d413fbd
authored
Jul 04, 2013
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indexing is configurable by a preference
parent
dd8f86d0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
product/ERP5SyncML/Document/SyncMLSubscription.py
product/ERP5SyncML/Document/SyncMLSubscription.py
+20
-8
No files found.
product/ERP5SyncML/Document/SyncMLSubscription.py
View file @
7d413fbd
...
@@ -111,9 +111,15 @@ class SyncMLSubscription(XMLObject):
...
@@ -111,9 +111,15 @@ class SyncMLSubscription(XMLObject):
activate_kw : activity parameters to pass to activate call
activate_kw : activity parameters to pass to activate call
kw : any parameter getAndActivate can required if it calls itself
kw : any parameter getAndActivate can required if it calls itself
"""
"""
if
kw
.
has_key
(
"packet_size"
):
search_kw
=
dict
(
kw
)
search_kw
=
dict
(
kw
)
packet_size
=
search_kw
.
pop
(
'packet_size'
,
30
)
packet_size
=
search_kw
.
pop
(
'packet_size'
,
30
)
limit
=
packet_size
*
search_kw
.
pop
(
'activity_count'
,
100
)
limit
=
packet_size
*
search_kw
.
pop
(
'activity_count'
,
100
)
else
:
# We index everything at once
limit
=
None
packet_size
=
None
search_kw
=
None
try
:
try
:
r
=
self
.
getDocumentIdList
(
limit
=
limit
,
**
search_kw
)
# It is assumed that
r
=
self
.
getDocumentIdList
(
limit
=
limit
,
**
search_kw
)
# It is assumed that
# the result is sorted
# the result is sorted
...
@@ -128,7 +134,8 @@ class SyncMLSubscription(XMLObject):
...
@@ -128,7 +134,8 @@ class SyncMLSubscription(XMLObject):
result_count
=
len
(
r
)
result_count
=
len
(
r
)
generated_other_activity
=
False
generated_other_activity
=
False
if
result_count
:
if
result_count
:
syncml_logger
.
info
(
"getAndIndex : got %d, %r result, limit = %d, packet %d"
%
# XXX If not split, call the callback here, no need of activity
syncml_logger
.
info
(
"getAndIndex : got %d, %r result, limit = %r, packet %r"
%
(
result_count
,
r
,
limit
,
packet_size
))
(
result_count
,
r
,
limit
,
packet_size
))
if
result_count
==
limit
:
if
result_count
==
limit
:
# Recursive call to prevent too many activity generation
# Recursive call to prevent too many activity generation
...
@@ -152,7 +159,7 @@ class SyncMLSubscription(XMLObject):
...
@@ -152,7 +159,7 @@ class SyncMLSubscription(XMLObject):
activate_kw
=
activate_kw
,
activate_kw
=
activate_kw
,
**
method_kw
)
**
method_kw
)
else
:
else
:
if
result_count
>
packet_size
:
if
result_count
>
packet_size
and
limit
:
for
i
in
xrange
(
0
,
result_count
-
packet_size
,
packet_size
):
for
i
in
xrange
(
0
,
result_count
-
packet_size
,
packet_size
):
syncml_logger
.
info
(
"-- getAndIndex : i %s, call, generating for %s : %s"
%
syncml_logger
.
info
(
"-- getAndIndex : i %s, call, generating for %s : %s"
%
(
i
,
r
[
i
:
i
+
packet_size
],
activate_kw
))
(
i
,
r
[
i
:
i
+
packet_size
],
activate_kw
))
...
@@ -446,6 +453,7 @@ class SyncMLSubscription(XMLObject):
...
@@ -446,6 +453,7 @@ class SyncMLSubscription(XMLObject):
# XXX Some improvement can also be done to retrieve a list of document at once
# XXX Some improvement can also be done to retrieve a list of document at once
# Get the data
# Get the data
syncml_logger.info("
applySync
:
got
data
%
r" %(action["
raw_data
"],))
if 'xml_data' in action:
if 'xml_data' in action:
# Rebuild an Element
# Rebuild an Element
incoming_data = etree.fromstring(action["
xml_data
"])
incoming_data = etree.fromstring(action["
xml_data
"])
...
@@ -1157,7 +1165,6 @@ class SyncMLSubscription(XMLObject):
...
@@ -1157,7 +1165,6 @@ class SyncMLSubscription(XMLObject):
("
one_way_from_client
", "
refresh_from_client_only
")):
("
one_way_from_client
", "
refresh_from_client_only
")):
portal = self.getPortalObject()
portal = self.getPortalObject()
pref = portal.portal_preferences
# First we must unindex everything
# First we must unindex everything
portal.z_unindex_syncml_data(path=self.getSearchableSourcePath())
portal.z_unindex_syncml_data(path=self.getSearchableSourcePath())
if self.getIsActivityEnabled():
if self.getIsActivityEnabled():
...
@@ -1166,12 +1173,17 @@ class SyncMLSubscription(XMLObject):
...
@@ -1166,12 +1173,17 @@ class SyncMLSubscription(XMLObject):
'tag' : self.getRelativeUrl(),
'tag' : self.getRelativeUrl(),
'priority' :ACTIVITY_PRIORITY
'priority' :ACTIVITY_PRIORITY
}
}
pref = portal.portal_preferences
if pref.getPreferredSplitIndexation():
kw = {'packet_size' : pref.getPreferredDocumentRetrievedPerActivityCount(),
'activity_count' : pref.getPreferredRetrievalActivityCount()}
else:
kw = {}
self.getAndIndex(
self.getAndIndex(
callback="
SQLCatalog_indexSyncMLDocumentList
",
callback="
SQLCatalog_indexSyncMLDocumentList
",
method_kw={'subscription_path' : self.getRelativeUrl()},
method_kw={'subscription_path' : self.getRelativeUrl()},
activate_kw=activate_kw,
activate_kw=activate_kw,
packet_size=pref.getPreferredDocumentRetrievedPerActivityCount(),
**kw
activity_count=pref.getPreferredRetrievalActivityCount(),
)
)
else:
else:
r = [x.getPath() for x in self.getDocumentList()]
r = [x.getPath() for x in self.getDocumentList()]
...
...
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