Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
basic
Commits
1d0f21ae
Commit
1d0f21ae
authored
4 years ago
by
a.niebisch
Browse files
Options
Downloads
Patches
Plain Diff
#1059353 refactored id filter for the duplicates search
parent
db3a5df3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
process/DuplicateScanner_lib/process.js
+17
-7
17 additions, 7 deletions
process/DuplicateScanner_lib/process.js
with
17 additions
and
7 deletions
process/DuplicateScanner_lib/process.js
+
17
−
7
View file @
1d0f21ae
...
...
@@ -910,9 +910,8 @@ pResultFields, pRecordIdValueToIgnore, pFormatValuesConsumeWebserviceCallback, p
let
ignoreSourceRecordPattern
=
_DuplicateScannerUtils
.
_getIgnoreSourceRecordPattern
(
pRecordIdValueToIgnore
);
let
indexPatternWithValues
=
_DuplicateScannerUtils
.
_replacePlaceholderForValuesInPattern
(
pIndexPattern
,
pEntityFieldConfigValuesRay
);
indexPatternWithValues
=
ignoreSourceRecordPattern
+
indexPatternWithValues
+
"
)
"
;
possibleDuplicates
=
_DuplicateScannerUtils
.
_callIndexSearch
(
pTargetEntity
,
indexPatternWithValues
,
pResultFields
,
100
);
possibleDuplicates
=
_DuplicateScannerUtils
.
_callIndexSearch
(
pTargetEntity
,
indexPatternWithValues
,
ignoreSourceRecordPattern
,
pResultFields
,
100
);
if
(
possibleDuplicates
==
null
)
return
null
;
...
...
@@ -948,11 +947,12 @@ _DuplicateScannerUtils._isUseExternalWebservice = function(pFilterName, pTargetE
*
* @param {String} pTargetEntity Entity which has been configured
* @param {String} pIndexPatternWithValues The pattern used to search. Has to contain the values already.
* @param {String} pIdFilter The filter pattern used to exclude the current record from the result.
* @param {String} pResultFields The result field config. Use "DuplicateScannerUtils.LoadResultFields"
* @param {String} pResultSetRows todo
* @returns {[["key", "value"]] || null} Array of Key-Value-Pairs based on the configured pResultFields, if no pattern exists null
*/
_DuplicateScannerUtils
.
_callIndexSearch
=
function
(
pTargetEntity
,
pIndexPatternWithValues
,
pResultFields
,
pResultSetRows
)
_DuplicateScannerUtils
.
_callIndexSearch
=
function
(
pTargetEntity
,
pIndexPatternWithValues
,
pIdFilter
,
pResultFields
,
pResultSetRows
)
{
logging
.
log
(
pIndexPatternWithValues
)
//The indexPattern can't be null because it is required to run the search.
...
...
@@ -961,9 +961,13 @@ _DuplicateScannerUtils._callIndexSearch = function(pTargetEntity, pIndexPatternW
let
indexQuery
=
indexsearch
.
createIndexQuery
()
.
setPattern
(
pIndexPatternWithValues
)
.
setEntities
([
pTargetEntity
])
// .addFilter(pIdFilter);
// .setDefaultOperator(indexsearch.OPERATOR_AND)
//.addSearchFields("Person_entity.FIRSTNAME", "Person_entity.LASTNAME", "Person_entity.CONTACTID")
//.setRows(pResultSetRows);
if
(
pIdFilter
&&
pIdFilter
.
length
>
0
)
indexQuery
.
addFilter
(
pIdFilter
);
indexQuery
=
_DuplicateScannerUtils
.
_setResultFields
(
indexQuery
,
pResultFields
);
return
indexsearch
.
searchIndex
(
indexQuery
);
}
...
...
@@ -1102,14 +1106,20 @@ _DuplicateScannerUtils._buildDeleteCachedUnrelatedDuplicateQuery = function(pSou
}
/*
* Creates a pattern which excludes
the field and it's value
* Creates a
filter
pattern which excludes
results with the provided id from the search.
*
* @param {String} pRecordIdValueToIgnore The
fields value
* @returns {String}
P
attern which excludes the give
d fiel
d in
combination with the value
* @param {String} pRecordIdValueToIgnore The
id value to exclude from the result.
* @returns {String}
Filter p
attern which excludes
hits with
the give
n i
d
(
in
dex) from the result.
*/
_DuplicateScannerUtils
.
_getIgnoreSourceRecordPattern
=
function
(
pRecordIdValueToIgnore
)
{
return
"
( +( -
"
+
indexsearch
.
FIELD_ID
+
"
:(
"
+
pRecordIdValueToIgnore
+
"
) )
"
;
// creates -_local_id_:"<pRecordIdValueToIgnore>"
if
(
pRecordIdValueToIgnore
&&
pRecordIdValueToIgnore
.
length
>
0
)
return
indexsearch
.
buildPattern
(
indexsearch
.
createPatternConfig
().
minus
(
indexsearch
.
createPhraseTerm
(
pRecordIdValueToIgnore
)
.
setIndexField
(
indexsearch
.
FIELD_ID
)
));
return
null
;
}
_DuplicateScannerUtils
.
_buildUpdateContactIdStatements
=
function
(
pTableInfos
,
pSourceContactId
,
pTargetContactId
,
pAlias
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment