Deduplication

Learn how to use the scripting console to deduplicate items in a case.

Example Scripts

The following scripts show simple examples of how to deduplicate items using the script console in Nuix Workstation.

1
2
3
4
5
items=$current_case.searchUnsorted('')
start=Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
dedupedItems=$utilities.getItemUtility().deduplicate(items);
elapsed=Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond) - start
puts "Deduplicated #{dedupedItems.count} items in #{elapsed} ms."
1
2
3
4
5
6
items=$current_case.searchUnsorted('');
start = Date.now();
dedupedItems=$utilities.getItemUtility().deduplicate(items);
end = Date.now();
elapsed = parseInt(end - start)
print("Deduplicated " + dedupedItems.length + " items in " + elapsed + " ms.")
1
2
3
4
5
6
7
8
import time

items=current_case.searchUnsorted('');
start = int(time.time() * 1000)
dedupedItems=utilities.getItemUtility().deduplicate(items);
end = int(time.time() * 1000)
elapsed = (end - start) * 1000
print('Deduplicated ' + str(len(dedupedItems)) + ' items in ' + str(elapsed) + ' ms.')

Console Output

Command Line

You can also use Nuix Console to execute scripts in Ruby, Javascript/ECMAScript, and Python. First create a Nuix Console wrapper script and then pass it as an argument to the Nuix Console application. One of the main differences between executing scripts in this mode is that the $current_case variable is not injected into the script. You will have to open the case directly in this mode.

caze = $utilities.getCaseFactory().open("/cases/deduplicateExample");

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Nuix Console Wrapper Script

NUIX='/path/to/nuix/console'
SCRIPT='/path/to/script/deduplicate.rb'
LICENSE_SOURCE=cloud-server
LICENSE_TYPE=enterprise-workstation
JVM_ARGS=-Xmx8g
LOG_DIR=/var/log
export NUIX_USERNAME="<YOUR_USERNAME>"
export NUIX_PASSWORD="<YOUR_PASSWORD>"
exec env "${NUIX}" "${JVM_ARGS}" -licencesourcetype "${LICENSE_SOURCE}" -licencetype "${LICENSE_TYPE}" \
    "${SCRIPT}" -Dnuix.logdir="${LOG_DIR}"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
REM Nuix Console Wrapper Script

SET NUIX="C:\Program Files\Nuix\Nuix 9.10\nuix_console.exe"
SET SCRIPT="C:\Users\windows\Documents\deduplicate.rb"
SET LICENSE_SOURCE="cloud-server"
SET LICENSE_TYPE="enterprise-workstation"
SET JVM_ARGS="-Xmx8g"
SET LOG_DIR="C:\Temp"
SET NUIX_USERNAME="<YOUR_USERNAME>"
SET NUIX_PASSWORD="<YOUR_PASSWORD>"
%NUIX% %JVM_ARGS% -licencesourcetype %LICENSE_SOURCE% -licencetype %LICENSE_TYPE% ^
    %SCRIPT% -Dnuix.logdir=%LOG_DIR%