OracleText:在html文件中搜索单词

时间:2019-03-20 01:25:47

标签: oracle-text

我创建了2个文件HTML: CiaoMondo.html

<!doctype html>
<html lang="it">
    <head>
        <title>Ciao Mondo!</title>
    </head>
    <body>
        <h1>Oracle Text provides indexing elements for creating Oracle  Text indexes and for specifying indexing preferences. This chapter describes the indexing elements that you can use to create an Oracle Text index.</h1>
    </body>
</html>

和CiaoOracle.html

<!doctype html>
<html lang="it">
    <head>
        <title>Ciao Oracle!</title>
    </head>
    <body>
        <h1>La Mare Jonio lascia il punto di fonda ed entra nel porto di
        Lampedusa dove la Guardia di finanza notifica il provvedimento di sequestro. I migranti sbarcano tutti. Poi il comandante, Pietro Marrone, viene convocato d'urgenza dalle fiemme gialle di Lampedusa. Marrone si é recato in caserma accompagnato dall'armatore Beppe Caccia e dal deputato di Sinistra italiana Erasmo Palazzotto. A quanto si apprende i militari dovrebbero notificare al comandante un atto.
        </h1>
    </body>
</html>

现在,我已以以下方式在Oracle的表中导入(或尝试了): Oracle's instuction 现在,我想在这两个文件的H1标记中搜索一个词(例如:Jonio)。 我执行了以下指令:

SELECT SCORE(1), id 
from htmlprova
WHERE CONTAINS(docs, 'Jonio within H1') > 0
order by score(1) desc;

但是

Error starting at line 1 in command:
SELECT SCORE(1), id
from htmlprova
WHERE CONTAINS(docs, 'Jonio within H1') > 0
order by score(1) desc
Error at Command Line:1 Column:7
Error report:
SQL Error: ORA-29908: missing primary invocation for ancillary operator
29908. 00000 -  "missing primary invocation for ancillary operator"
*Cause:    The primary invocation corresponding to an ancillary operator
           is missing.
*Action:   Add the primary invocation with the same label as the
           ancillary operator.

我该如何解决?

1 个答案:

答案 0 :(得分:0)

请参考CONTAINS语法。使用SCORE运算符时,需要指定label

对于您的查询,请在文本搜索字符串后直接添加1

WHERE CONTAINS(docs, 'Jonio within H1',1) > 0

那应该解决SQL Error: ORA-29908