以下の情報は Windows に適用されます (301 バイト)以下の情報は AIX に適用されます (307 バイト)以下の情報は Solaris に適用されます (388 バイト)以下の情報は Linux に適用されます (282 バイト)独立した検索スペース用の商品アドバイザー検索スペースの手動作成

商品アドバイザー検索スペースを手動で作成するには、カタログ・サブシステムおよび関連したデータベース・スキーマについて十分に理解している必要があります。 検索スペースは、次の標準 WebSphere Commerce テーブルからエクスポートされた情報を含む、 追加のデータベース・テーブルから成ります。
以下の情報は iSeries 400 に適用されます (278 バイト) 注: この情報は iSeries ユーザーには適用されません。 商品アドバイザー検索スペースの XML ファイルを使用した作成を参照してください。

以下のステップは、商品アドバイザー検索をサポートするためになくてはならないデータベース・テーブルの作成に必要なものです。 以下のステップでは、テーブル、ビュー、および適切な索引から成る簡単な検索スペースを作成するサンプル SQL ステートメントが使用されます。 これらのステートメントには、自身のデータで置き換えなければならないデータ、 たとえば商品 ID やカテゴリー ID などが入っています。 これらは、ここでは、実演の目的で表示されるものです。 SQL ステートメントがデータを戻すような場合、 特にこれらのデータが後続のステップで入力として使用される時には、戻されるデータは、 その SQL ステップの後に大括弧で囲んで太字で表示されます。

注: このファイルの例は DB2 特定のものです。 Oracle ユーザーは、Oracle 特定の SQL ステートメントに該当するサンプル・ユーティリティーを参照してください。

  1. 商品アドバイザー検索を使用可能にしたいカテゴリーを決める。 この例では、カテゴリー "1" が使用されます。
  2. そのカテゴリーについて、すべての商品属性およびそれらのタイプをリストする。 次の SQL ステートメントを出して、そのカテゴリーに固有の ID 番号を取得します。

    db2 "select distinct(attribute_id),language_id,attrtype_id,name       
         from attribute
         where
         catentry_id in(select catentry_id from catgpenrel where
         catgroup_id=1)
         order by attribute_id"

  3. そのカテゴリー内のすべての商品に共通する 1 つ以上の属性を選択する。 たとえば、タイプ String の 'Color' やタイプ Integer の 'Size' などです。
  4. 商品 ID や商品説明などの標準商品属性、およびステップ 3 で指定されるユーザー定義商品属性 (Color および Size) を使って、検索スペースを作成する。
    [カテゴリー 1 の検索スペースは ICT1、ICTDESC1、ICV1_NULL から成ります]
    次の SQL ステートメントを出します。

    db2 create table ICT1
                   ( PRRFNBR int not null,
                     PRNBR varchar(64) );
    db2 create table ICTDESC1
                   ( PRRFNBR int not null,
                     PRSDESC varchar(254),
                     AVAILABLE int not null,
                     PRTHMB varchar(254),
                     XMLDETAIL long varchar,
                     LANGUAGE_ID int not null,
                     F_COLOR char(254),
                     F_SIZE int,
                     Constraint ictd1_pk
                     primary key (prrfnbr,language_id) );
    db2 create view  ICV1_NULL as select ic.prrfnbr,
                                      ic.prnbr,
                                      icd.PRSDESC,
                                      icd.AVAILABLE,
                                      icd.PRTHMB,
                                      icd.XMLDETAIL,
                                      icd.LANGUAGE_ID,
                                      icd.F_COLOR,
                                      icd.F_SIZE,
                                      p.ipsgnbr,
                                      p.storeid,
                                      p.ppprc,
                                      p.setccurr
                               from ICTPRICES p, ICT1 ic, ICTDESC1 icd
                               where ic.PRRFNBR=p.CATENTRY_ID and
                                     ic.PRRFNBR=icd.PRRFNBR and
                                     p.IPSGNBR is NULL;

  5. カテゴリーの検索スペースは、ICROOTCAT テーブルにそのカテゴリーの行がある時に存在します。 作成された各検索スペースについてメタ・データを挿入する。 次の SQL ステートメントを出す。

    db2 "insert into icrootcat
         (rootcategoryid,catgroup_id,pfpasync,pfreq,tablename,
          lastmodified)
         values
         (1,1,0,1,'ICV1_','2000-06-15-14.48.25.686000')"

  6. ICEXPLFEAT テーブルには、すべての検索可能属性の行があります。 KEYS テーブルから FEATUREID 値を取得することができます。
    次の SQL ステートメントを出して、各ユーザー定義商品属性のメタ・データを挿入する。

    db2 "insert into icexplfeat
         (featureid,catgroup_id,columnname,length,datatype,keysequence,
          nullable,location,included,relevance)
         values
         (1, 1,'F_COLOR',254,'com.ibm.commerce.datatype.DsString',
          0,1,1,1,0);
    db2 "insert into icexplfeat
         (featureid,catgroup_id,columnname,length,datatype,keysequence,
          nullable,location,included,relevance)
         values
         (2, 1,'F_SIZE',4,'com.ibm.commerce.datatype.DsInteger',
          0,1,1,1,0);

  7. 各標準商品属性のメタ・データを挿入する。 変更不要の以下の SQL ステートメントを出す。

    db2 "insert into icexplfeat
         (featureid,catgroup_id,columnname,length,datatype,keysequence,
          nullable,location,included,relevance)
         values
         (3, 1,'PRRFNBR',4,'com.ibm.commerce.datatype.DsInteger',
          1,0,0,1,0);
    db2 "insert into icexplfeat
         (featureid,catgroup_id,columnname,length,datatype,keysequence,
          nullable,location,included,relevance)
         values
         (4,1,'PRNBR',254,'com.ibm.commerce.datatype.DsString',
          0,0,0,1,0);
    db2 "insert into icexplfeat
         (featureid,catgroup_id,columnname,length,datatype,keysequence,
          nullable,location,included,relevance)
         values
         (5, 1,'PRSDESC',254,'com.ibm.commerce.datatype.DsString',
          0,1,3,1,0);
    db2 "insert into icexplfeat
         (featureid,catgroup_id,columnname,length,datatype,keysequence,
          nullable,location,included,relevance)
         values
         (6, 1,'PRTHMB',254,'com.ibm.commerce.datatype.DsImage',
          0,1,3,1,0);
    db2 "insert into icexplfeat
         (featureid,catgroup_id,columnname,length,datatype,keysequence,
          nullable,location,included,relevance)
         values
         (7, 1,'XMLDETAIL',32700,'com.ibm.commerce.datatype.DsURLLink',
          0,1,3,1,0);
    db2 "insert into icexplfeat
         (featureid,catgroup_id,columnname,length,datatype,keysequence,
          nullable,location,included,relevance)
         values
         (8, 1,'PPPRC',16,'com.ibm.commerce.datatype.DsCurrency',
          0,0,2,1,0);
    db2 "insert into icexplfeat
         (featureid,catgroup_id,columnname,length,datatype,keysequence,
          nullable,location,included,relevance)
         values
         (9, 1,'AVAILABLE',4,'com.ibm.commerce.datatype.DsInteger',
          0,0,3,1,0);

  8. ICEXPLDESC テーブル内のサポートされている各言語に、 すべての検索可能属性についてそれぞれ 1 行があります。 次の SQL ステートメントを出して、各ユーザー定義商品属性について各言語のメタ・データを挿入する。 NAME 列の値は、ATTRIBUTE テーブルの NAME 列からの値と同じにする。

    db2 "insert into icexpldesc (featureid,language_id,name,
          unitofmeasure,description,elaboration,scale,precision)
         values
         (1, 1,'Color','','Color',NULL,0,0);
    db2 "insert into icexpldesc (featureid,language_id,name,
          unitofmeasure,description,elaboration,scale,precision)
         values
         (2, 1,'Size','','Size',NULL,0,0);

  9. 各標準商品属性について各言語のメタ・データを挿入する。 DESCRIPTION 列は各国語に翻訳する。

    db2 "insert into icexpldesc (featureid,language_id,name,
          unitofmeasure,description,elaboration,scale,precision)
         values
         (3, 1,'CATENTRY_ID','','Product Reference Number',NULL,0,0);
    db2 "insert into icexpldesc (featureid,language_id,name,
          unitofmeasure,description,elaboration,scale,precision)
         values
         (4, 1,'PARTNUMBER','','ProductNumber/SKU',NULL,0,0);
    db2 "insert into icexpldesc (featureid,language_id,name,
          unitofmeasure,description,elaboration,scale,precision)
         values
         (5, 1,'SHORTDESCRIPTION','','Short Description',NULL,0,0);
    db2 "insert into icexpldesc (featureid,language_id,name,
          unitofmeasure,description,elaboration,scale,precision)
         values
         (6, 1,'THUMBNAIL','','Thumbnail Image File',NULL,0,0);
    db2 "insert into icexpldesc (featureid,language_id,name,
          unitofmeasure,description,elaboration,scale,precision)
         values
         (7, 1,'XMLDETAIL','','XML Detail',NULL,0,0);
    db2 "insert into icexpldesc (featureid,language_id,name,
          unitofmeasure,description,elaboration,scale,precision)
         values
         (8, 1,'STANDARDPRICE','','MSRP',NULL,2,15);
    db2 "insert into icexpldesc (featureid,language_id,name,
         unitofmeasure,description,elaboration,scale,precision)
         values
         (9, 1,'AVAILABLE','','Availability',NULL,0,0);

  10. CATENTRY から ICT1 にデータを抽出する。 次の SQL コマンドを出す。

    db2 "insert into ict1 (select catentry_id,partnumber
         from catentry where catentry_id in (select catentry_id
         from catgpenrel where catgroup_id=1))"
    db2 "import from catentry.del of del insert into ict1"

  11. CATENTDESC から ICTDESC1 にデータを抽出する。 各言語について次のことを行う必要があります。 次の例は英語の場合です。 次の SQL コマンドを出す。

    db2 "insert into ictdesc1 (PRRFNBR,PRSDESC,AVAILABLE,
         PRTHMB,XMLDETAIL,LANGUAGE_ID)
         (select c2.catentry_id,c2.shortdescription,c2.available,
         c2.thumbnail,c2.xmldetail, c2.language_id
         from catentry c1,catentdesc c2
         where c1.catentry_id=c2.catentry_id
         and c2.language_id=-1
         and c2.published=1
         and (c2.catentry_id in (select catentry_id from catgpenrel
         where catgroup_id=1)))"

  12. 各ユーザー定義商品属性について、各言語の ATTRVALUE から ICTDESC1 にデータを抽出する。 各言語について次のことを行う必要があります。 次の例は英語の場合です。 次の SQL コマンドを出す。

    db2 "update ictdesc1 set F_Color =
         (select stringvalue from attrvalue
         where ictdesc1.prrfnbr=attrvalue.catentry_id
         and ictdesc1.language_id=attrvalue.language_id
         and attrvalue.attribute_id in
         (select attribute_id from attribute
         where name = 'Color')
         and attrvalue.language_id=-1
         and attrvalue.catentry_id in
         (select catentry_id from catgpenrel
         where catgroup_id=1))
         where language_id=-1"

    db2 "update ictdesc1 set F_Size =
         (select integervalue from attrvalue
         where ictdesc1.prrfnbr=attrvalue.catentry_id
         and ictdesc1.language_id=attrvalue.language_id
         and attrvalue.attribute_id in
         (select attribute_id from attribute
         where name = 'Size')
         and attrvalue.language_id=-1
         and attrvalue.catentry_id in
         (select catentry_id from catgpenrel
         where catgroup_id=1))
         where language_id=-1"

  13. 商品価格を OFFERPRICE テーブルから ICTPRICES テーブルに抽出する。 すべての商品には、それぞれの通貨での価格があります。

    db2 "insert into ictprices(storeid, catentry_id,setccurr,ppprc)
         select storeent_id, catentry_id, currency, price
         from storeent, offer, offerprice,tradeposcn
         where storeent_id=0
         and tradeposcn_id=offer.tradeposcn_id
         and offer.offer_id=offerprice.offer_id
         and tradeposcn.type='S'"

関連概念

関連タスク

IBM 著作権