DBMaker 全文檢索函數

HIGHLIGHT

語法:

    HIGHLIGHT(text long varchar, BoolPatn varchar(512), sensitive int, PreTag varchar(100),
           EndTag Varchar(100) ) return long varchar.
       

Table 3-2. HIGHLIGHT 函數

  parameter type Description
IN text LVC source text
  BoolPatn CHAR match pattern (can be Boolean expression pattern)
  sensitive INT whether sensitive match
  PreTag CHAR tag before pattern, NULL denote none
  EndTag CHAR tag after pattern, NULL denote none
OUT   BLOB text after highlighting the patterns

說明:

找出具檢索關鍵字的文章,並在檢索關鍵字的前後自動加上指定的文字。

範例:

找出content欄位中有 Intel 或 AMD 的文章,並將 Intel 或 AMD 用紅色標示。

    select highlight(content,’Intel | AMD’,0,’<Font color="#FF0000">’,’</Font>’) from
         news where content match ’Intel | AMD’;
       
HITCOUNT

語法:

    HITCOUNT(text long varchar, BoolPatn VARCHAR(512), sensitive int) return int.
       

Table 3-3. HITCOUNT 函數

  parameter type Description
IN text LVC source text
  BoolPatn CHAR match pattern (can be Boolean expression pattern)
  sensitive INT whether sensitive match
OUT   INT appearance times of search pattern

說明:

計算文章中該檢索關鍵字出現的次數。

範例:

    select 
    
    hitcount(content,'Intel|AMD',0), highlight(content,'Intel|AMD',0,‘<Font color="#FF0000">’,
        ’</Font>’) from news where content match 'Intel|AMD' order by 1;
       
HITPOS

語法:

    HITPOS(text long varchar, BoolPatn varchar(512), sensitive int, n int, RetType int) return int
       

Table 3-4. HITPOS 函數

  parameter type description
IN text LVC source text
  BoolPatn CHAR match pattern (can be Boolean expression pattern)
  sensitive INT whether sensitive match
  n INT the n-th pattern (start at 1),at most, n could be 10000 (MaxPosPtn)
  RetType INT return position type
      0: begin offset (default setting)
      1: end offset
      2: pattern length (endoff - begoff + 1)
      3: begin offset (higer 24 bits) BINARY OR end offset (lower 8 bits)
OUT   INT get position information of the n-th pattern found in text, return 0 if n-th pattern is not found

說明:

找出檢索關鍵字在文章中出現第n次的位置。

範例:

假設 content 欄位內容為"a b A c"

    HITPOS(content,'A', 1, 1, 0) = 5 ('A')
    
    HITPOS(content,'A&B' 0, 2, 0) = 3 ('b')
    
    HITPOS(content,'a|b|c', 0, 3, 0) = 5 ('A')
    
    HITPOS(content,'!a&c' 0, 1, 0) = 7 ('c')
       
BLOBLEN

語法:

    BLOBLEN (object long varbinary) return int
       

Table 3-5. BLOBLEN 函數

  parameter type Description
IN object LVB Source blob
OUT   INT get blob type data length

說明:

計算某一個 BLOB 欄位的長度。

範例:

    select bloblen(content) from news
       
HTMLTITLE

語法:

    HTMLTITLE (text long varchar) return varchar(1000)
       

Table 3-6. HTMLTITLE 函數

  parameter type Description
IN object LVB Source HTML data
OUT   varchar Title string of HTML

說明:

找出HTML文章中的Title

範例:

    select htmltitle(content) from news
       
Copyright 2002 SYSCOM Computer Engineering Co. All rights reserved.