Skip to content

Commit

Permalink
TextSearch demo used in IDUG 2022 (#49)
Browse files Browse the repository at this point in the history
* TS Demo used in IDUG 2022

Signed-off-by: czentgr <[email protected]>

* Rename files and make minor comment updates

Signed-off-by: czentgr <[email protected]>

* More README changes

Signed-off-by: czentgr <[email protected]>

Co-authored-by: czentgr <[email protected]>
  • Loading branch information
czentgr and czentgr authored Jul 7, 2022
1 parent 92cbb0e commit 8d71c80
Show file tree
Hide file tree
Showing 7 changed files with 1,537 additions and 0 deletions.
Binary file added textsearch/books/ACID.pdf
Binary file not shown.
Binary file added textsearch/books/FFT.pdf
Binary file not shown.
36 changes: 36 additions & 0 deletions textsearch/books/tsBookDemoDDL.db2
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
----------------------------------------------------------------------------
-- Licensed Materials - Property of IBM
-- Governed under the terms of the IBM Public License
--
-- (C) COPYRIGHT International Business Machines Corp. 2022
-- All Rights Reserved.
--
-- US Government Users Restricted Rights - Use, duplication or
-- disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
----------------------------------------------------------------------------
--
-- Product Name: Db2 Text Search
--
-- Source File Name: tsBookDemoDDL.db2
--
-- Version: Any
--
-- Description: Create text search tables in the sample database.
--
-- SQL STATEMENTS USED:
-- CREATE TABLE
--
--
----------------------------------------------------------------------------

CREATE TABLE TS_DEMO.BOOKS
( PK integer not null primary key,
ISBN VARCHAR(18),
TITLE VARCHAR(100),
AUTHORS VARCHAR(200),
PUBLISHERS VARCHAR(200),
YEAR INTEGER,
ABSTRACT CLOB(1M),
PDF BLOB(2G),
BOOK XML
) DATA CAPTURE NONE ORGANIZE BY ROW;
48 changes: 48 additions & 0 deletions textsearch/books/tsBookDemoInsertLobsTemplate.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#---------------------------------------------------------------------------
#- Licensed Materials - Property of IBM
#- Governed under the terms of the IBM Public License
#-
#- (C) COPYRIGHT International Business Machines Corp. 2022
#- All Rights Reserved.
#-
#- US Government Users Restricted Rights - Use, duplication or
#- disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#---------------------------------------------------------------------------
#-
#- Product Name: Db2 Text Search
#-
#- Source File Name: tsBookDemoInsertLobsTemplate.cli
#-
#- Version: Any
#-
#- Description: Add LOB data to text search data.
#-
#- SQL STATEMENTS USED:
#- UPDATE
#-
#-
#---------------------------------------------------------------------------

opt echo on
opt callerror on

sqlallocenv 1
sqlallocconnect 1 1
sqlconnect 1 %DBNAME% -3

sqlallocstmt 1 1
getmem 1 14 sql_c_binary 2479595

updatemem 14 sql_c_binary file FFT.pdf
sqlprepare 1 "UPDATE TS_DEMO.BOOKS SET PDF = ? WHERE ISBN = '9780262032933'" -3
sqlsetparam 1 1 sql_c_binary sql_blob 1369227 0 14
sqlexecute 1

updatemem 14 sql_c_binary file ACID.pdf
sqlprepare 1 "UPDATE TS_DEMO.BOOKS SET PDF = ? WHERE ISBN = '3540421335'" -3
sqlsetparam 1 1 sql_c_binary sql_blob 2479594 0 14
sqlexecute 1

sqlfreestmt 1 sql_close
sqltransact 1 1 sql_commit
killenv 1
47 changes: 47 additions & 0 deletions textsearch/books/tsBookDemoREADME.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
* README file for Db2 Text Search samples
*
*
* (C) COPYRIGHT INTERNATIONAL BUSINESS MACHINES CORPORATION 2022.
*
* ALL RIGHTS RESERVED.
*

File: samples/textsearch/books/tsBookDemoREADME.txt
Demo files:
tsBookDemoRunDemo - ksh shell script to execute the demo
tsBookDemoDDL - DDL for the BOOKS table
tsBookDemoTableData - CLP script to insert non-LOB data
tsBookDemoInsertLobsTemplate.cli - CLI script to insert (via update) LOB data
ACID.pdf - BLOB demo data, ACM paper, see below for reference
FFT.pdf - BLOB demo data, ACM paper, see below for reference


The Db2 Text Search sample consists of a script written in SQL that
highlights the Text Search functionality.

The sample includes two ACM papers in PDF as examples that are loaded into the
sample database and indexed after enabling the Rich Text Filter.

The papers are publicly available on the ACM website. The download links are given below.
The references are as follows:

1) FFT.pdf - SHA256: f4333d6d903cf03a306c6f6b17cdb7ffb3c34536ce3dde100f82915eef8ebc59
Thomas H. Cormen, David M. Nicol, Out-of-core FFTs with parallel disks,
ACM SIGMETRICS Performance Evaluation Review, Volume 25, Issue 3, December 1997 pp 3–12, https://doi.org/10.1145/270900.270902
Download: https://dl.acm.org/doi/abs/10.1145/270900.270902

2) ACID.pdf - SHA256: 13dc152edc43c749f094bef0d60d4faf5c9596406c2b39c8d3f57f818e207055
Theo Haerder, Andreas Reuter, Principles of transaction-oriented database recovery,
ACM Computing Surveys, Volume 15, Issue 4, December 1983 pp 287–317, https://doi.org/10.1145/289.291
Download: https://dl.acm.org/doi/10.1145/289.291


"Out-of-core FFTs with parallel disks" is used as the PDF for the book with the
title "Introduction to Algorithms". For this book Thomas H. Cormen is one of the authors.
"Principles of transaction-oriented database recovery" is used as the PDF for
the book with the title "Datenbanksysteme". For this book Theo Haerder is one of the authors.

--------------------------------------------------------------------------------
Notes:
Prior to running the sample, the instance must be enabled for text search.
The remaining enablement is taken care of by the tsBookDemoRunDemo script.
Loading

0 comments on commit 8d71c80

Please sign in to comment.