Skip to content

Commit

Permalink
TS Demo used in IDUG 2022
Browse files Browse the repository at this point in the history
Signed-off-by: czentgr <[email protected]>
  • Loading branch information
czentgr committed Jul 6, 2022
1 parent 92cbb0e commit 02e7abb
Show file tree
Hide file tree
Showing 7 changed files with 1,529 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/tsDemoDDL.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: tsDemoDDL.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/tsDemoInsertLobsTemplate.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: tsDemoInsertLobsTemplate.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
39 changes: 39 additions & 0 deletions textsearch/books/tsDemoREADME.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
* README file for Db2 Text Search samples
*
*
* (C) COPYRIGHT INTERNATIONAL BUSINESS MACHINES CORPORATION 2022.
*
* ALL RIGHTS RESERVED.
*

File: samples/textsearch/README.txt

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
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
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 script.
Loading

0 comments on commit 02e7abb

Please sign in to comment.