Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a new dataset for a new demo #51

Merged
merged 2 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
For loading the GoSalesSubSet.csv data you can take the following steps:


db2start
connect to <database_name>

db2 "CREATE TABLE GOSALES.GOSALES_FULL (
ID INTEGER NOT NULL,
GENDER VARCHAR(3),
AGE INTEGER,
MARITAL_STATUS VARCHAR(30),
PROFESSION VARCHAR(30),
PURCHASE_AMOUNT DECIMAL(30, 5),
PRIMARY KEY (ID))";

db2 "IMPORT FROM \"<full_path_to_csv>\" OF DEL skipcount 1 INSERT INTO GOSALES.GOSALES_FULL(ID, GENDER, AGE,
MARITAL_STATUS, PROFESSION, PURCHASE_AMOUNT)"

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