Home » Server Options » Text & interMedia » Html sectioning and CONTAINS query
Html sectioning and CONTAINS query [message #285175] Mon, 03 December 2007 17:02 Go to next message
drimades
Messages: 13
Registered: June 2007
Junior Member
I have:

DECLARE
2 content CLOB;
3 uri httpuritype;
4 BEGIN
5 uri := httpuritype.createUri('http://www.google.com');
6 content := uri.getClob();
7 END;


the field of the table authors in this case is uri and is declared as httpuritype

how can I use HTML_SECTION_GROUP or something similar to section the html text that I have in content in the sections TITLE, HEADING, BODY, etc. so to perform CONTAINS queries like ... WHERE CONTAINS(TITLE, StringToFind) etc.?
Re: Html sectioning and CONTAINS query [message #285194 is a reply to message #285175] Mon, 03 December 2007 21:50 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8631
Registered: November 2002
Location: California, USA
Senior Member
I am not sure that I understand your requirements. Please see if the following helps. If not, please provide clarification of your requirements, with examples, if possible.


SCOTT@orcl_11g> CREATE TABLE authors
  2    (id  NUMBER,
  3  	uri httpuritype)
  4  /

Table created.

SCOTT@orcl_11g> INSERT INTO authors VALUES (1, httpuritype.createUri('http://www.google.com'))
  2  /

1 row created.

SCOTT@orcl_11g> INSERT INTO authors VALUES (2, httpuritype.createUri('http://www.oracle.com'))
  2  /

1 row created.

SCOTT@orcl_11g> begin
  2    ctx_ddl.create_section_group('htmgroup', 'HTML_SECTION_GROUP');
  3    ctx_ddl.add_zone_section('htmgroup', 'title', 'title');
  4    ctx_ddl.add_zone_section('htmgroup', 'heading', 'heading');
  5    ctx_ddl.add_zone_section('htmgroup', 'body', 'body');
  6  end;
  7  /

PL/SQL procedure successfully completed.

SCOTT@orcl_11g> CREATE INDEX your_index
  2  ON authors (uri)
  3  INDEXTYPE IS CTXSYS.CONTEXT
  4  PARAMETERS ('SECTION GROUP htmgroup')
  5  /

Index created.

 
SCOTT@orcl_11g> VARIABLE stringtofind VARCHAR2(2000)
SCOTT@orcl_11g> EXEC :stringtofind := 'google'

PL/SQL procedure successfully completed.

SCOTT@orcl_11g> SELECT a.id, a.uri.getclob() FROM authors a
  2  WHERE  CONTAINS (uri, :stringtofind || ' WITHIN title') > 0
  3  /

        ID
----------
A.URI.GETCLOB()
--------------------------------------------------------------------------------
         1
<html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859
-1"><title>Google</title><style>body,td,a,p,.h{font-family:arial,sans-serif}.h{f
ont-size:20px}.h{color:#3366cc}.q{color:#00c}.ts td{padding:0}.ts{border-collaps
e:collapse}#gbar{float:left;font-weight:bold;height:22px;padding-left:2px}#gbh{b
order-top:1px solid #c9d7f1;font-size:0;height:0;position:absolute;right:0;top:2
4px;width:200%}#gbi{background:#fff;border:1px solid;border-color:#c9d7f1 #36c #
36c #a2bae7;font-size:13px;top:24px;z-index:1000}#guser{padding-bottom:7px !impo
rtant}#gbar,#guser{font-size:13px;padding-top:1px !important}@media all{.gb1,.gb
3{height:22px;margin-right:.73em;vertical-align:top}}#gbi,.gb2{display:none;posi
tion:absolute;width:8em}.gb2{z-index:1001}#gbar a,#gbar a:active,#gbar a:visited
{color:#00c;font-weight:normal}.gb2 a,.gb3 a{text-decoration:none}.gb2 a{display
:block;padding:.2em .5em}#gbar .gb2 a:hover{background:#36c;color:#fff}</style><
script>window.google={kEI:"IM1UR-nKMKTuoAThyvGlCw",kEXPI:"17259,17735",kHL:"en"}
;function sf(){document.f.q.focus()}
window.gbar={};(function(){;var g=window.gbar,a,f,h;function m(b,e,d){b.display=
b.display=="block"?"none":"block";b.left=e+"px";b.top=d+"px"}g.tg=function(b){va
r e=0,d,c,i,j=0,k=window.navExtra;!f&&(f=document.getElementById("gbar"));!h&&(h
=f.getElementsByTagName("span"));(b||window.event).cancelBubble=true;if(!a){a=do
cument.createElement(Array.every||window.createPopup?"iframe":"div");a.frameBord
er="0";a.id="gbi";a.scrolling="no";a.src="#";document.body.appendChild(a);if(k)f
or(var n in k){var l=document.createElement("span");l.appendChild(k[n]);l.classN
ame="gb2";f.appendChild(l)}document.onclick=g.close}for(;h[j];j++){c=h[j];i=c.cl
assName;if(i=="gb3"){d=c.offsetLeft;while(c=c.offsetParent)d+=c.offsetLeft;m(a.s
tyle,d,24)}else if(i=="gb2"){m(c.style,d+1,25+e);e+=20}}a.style.height=e+"px"};g
.close=function(b){a&&a.style.display=="block"&&g.tg(b)};})();</script></head><b
ody bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload
="sf();if(document.images){new Image().src='/images/nav_logo3.png'}" topmargin=3
 marginheight=3><div id=gbar><nobr><span class=gb1>Web</a></span> <span class=gb
1><a href="http://images.google.com/imghp?tab=wi">Images</a></span> <span class=
gb1><a href="http://maps.google.com/maps?tab=wl">Maps</a></span> <span class=gb1
><a href="http://news.google.com/nwshp?tab=wn">News</a></span> <span class=gb1><
a href="http://www.google.com/prdhp?tab=wf">Products</a></span> <span class=gb1>
<a href="http://mail.google.com/mail?tab=wm">Gmail</a></span> <span class=gb3><a
 href="http://www.google.com/intl/en/options/" onclick="this.blur();gbar.tg(even
t);return false"><u>more</u> <span style=font-size:11px>▼</span></a></span
> <span class=gb2><a href="http://blogsearch.google.com/?tab=wb">Blogs</a></span
> <span class=gb2><a href="http://books.google.com/bkshp?tab=wp">Books</a></span
> <span class=gb2><a href="http://www.google.com/calendar?tab=wc">Calendar</a></
span> <span class=gb2><a href="http://docs.google.com/?tab=wo">Documents</a></sp
an> <span class=gb2><a href="http://finance.google.com/finance?tab=we">Finance</
a></span> <span class=gb2><a href="http://groups.google.com/grphp?tab=wg">Groups
</a></span> <span class=gb2><a href="http://picasaweb.google.com/home?tab=wq">Ph
otos</a></span> <span class=gb2><a href="http://www.google.com/reader?tab=wy">Re
ader</a></span> <span class=gb2><a href="http://scholar.google.com/schhp?tab=ws"
>Scholar</a></span> <span class=gb2><a href="http://video.google.com/?tab=wv">Vi
deo</a></span> </nobr></div><div id=gbh></div><div align=right id=guser style="f
ont-size:84%;padding:0 0 4px" width=100%><nobr><a href="/url?sa=p&pref=ig&pval=3
&q=http://www.google.com/ig%3Fhl%3Den&usg=AFQjCNEj49wK5T88bDwGcaZsW52jiYwJwg">iG
oogle</a> | <a href="https://www.google.com/accounts/Login?continue=http://www.g
oogle.com/&hl=en">Sign in</a></nobr></div><center><br clear=all id=lgpd><img alt
="Google" height=110 src="/intl/en_ALL/images/logo.gif" width=276><br><br><form
action="/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td wi
dth=25%>&nbsp;</td><td align=center nowrap><input name=hl type=hidden value=en><
input type=hidden name=ie value="ISO-8859-1"><input maxlength=2048 name=q size=5
5 title="Google Search" value=""><br><input name=btnG type=submit value="Google
Search"><input name=btnI type=submit value="I'm Feeling Lucky"></td><td nowrap w
idth=25%><font size=-2>&nbsp;&nbsp;<a href=/advanced_search?hl=en>Advanced Searc
h</a><br>&nbsp;&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;&nbsp;<
a href=/language_tools?hl=en>Language Tools</a></font></td></tr></table></form><
br><br><font size=-1><a href="/intl/en/ads/">Advertising&nbsp;Programs</a> - <a
href="/services/">Business Solutions</a> - <a href="/intl/en/about.html">About G
oogle</a></font><p><font size=-2>&copy;2007 Google</font></p></center></body></h
tml>


SCOTT@orcl_11g> EXEC :stringtofind := 'Oracle 11g, Siebel, PeopleSoft | Oracle, The World''s Largest Enterprise Software Company'

PL/SQL procedure successfully completed.

SCOTT@orcl_11g> SELECT a.id, a.uri.getclob() FROM authors a
  2  WHERE  CONTAINS (uri, :stringtofind || ' WITHIN title') > 0
  3  /

        ID
----------
A.URI.GETCLOB()
--------------------------------------------------------------------------------
         2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Oracle 11g, Siebel, PeopleSoft | Oracle, The World's Largest Enterprise S
oftware Company</title>
<meta name="title" content="Enterprise Applications | Database | Fusion Middlewa
re | Applications Unlimited | Business | Oracle, The World's Largest Enterprise
Software Company">
<meta name="description" content="The world's largest enterprise software compan
y, Oracle is the only vendor to offer solutions for every tier of your business
-- database, middleware, business intelligence, business applications, and colla
boration. With Oracle, you get information that helps you measure results, impro
ve business processes, and communicate a single truth to your constituents.">
<meta name="keywords" content="enterprise, applications, software, database, mid
dleware, fusions, business, Oracle">
<META name="verify-v1" content="L5BQi/RrVPsU18TX4dMO0DI4h/0yyuTeSGSJt08wZA0=" />

<META name="verify-v1" content="2YG24oPrYhJQWzhSfkLcx4T2xuAQkda3wimYLmGXgYU=" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="/admin/hp.css" type="text/css">
<style type="text/css">
body {padding:10;margin:0;font-family:arial,helvetica,sans-serif;font-size:11px;
color:#000;}
a:link {color:#000;text-decoration:none;}
a:visited {color:#000;text-decoration:none;}
a:hover {color:#FF0000;text-decoration:underline;}

</style>
<script type="text/javascript" src="/admin/jscripts/hp.js"></script>
<script type="text/javascript">
var pageArray = new Array("page1","page2","page3");
var arrayLength = 3;
var currentIndex = 0;

/**************************Preloading Images ***************************/

image1 = new Image();
image2 = new Image();
image3 = new Image();

image1.src = "http://oracleimg.com/admin/images/ocom/hp/mainfeat_01.gif";
image2.src = "http://oracleimg.com/admin/images/ocom/hp/mainfeat_02.gif";
image3.src = "http://oracleimg.com/admin/images/ocom/hp/mainfeat_03.gif";

var theImage = new Array()
theImage[0] = 'http://oracleimg.com/admin/images/ocom/hp/featNav_1on.gif'
theImage[1] = 'http://oracleimg.com/admin/images/ocom/hp/featNav_2on.gif'
theImage[2] = 'http://oracleimg.com/admin/images/ocom/hp/featNav_3on.gif'
/***********************************************************************/
currentIndex = Math.floor(Math.random()*3);

var x=0;

//displayImage(currentIndex);

 function displayImage(i)
 {
 	orimage();

 	var blockName;
	var node ;
	for(j=0;j<3;j++)
	{
		blockName = pageArray[j];
		node = document.getElementById(blockName);
 		node.style.display="none";
	}

	blockName = pageArray[i];
	node = document.getElementById(blockName);
	document.getElementById("myImage" + (i+1)).src=theImage[i];
	node.style.display="block";
	currentIndex = i;
 }

function orimage()
{
document.getElementById("myImage1").src="http://oracleimg.com/admin/images/ocom/
hp/featNav_1off.gif"
document.getElementById("myImage2").src="http://oracleimg.com/admin/images/ocom/
hp/featNav_2off.gif"
document.getElementById("myImage3").src="http://oracleimg.com/admin/images/ocom/
hp/featNav_3off.gif"
}

</script>
<script type="text/javascript">
function doQuery(sel)
{
document.queryform.p_Query.value = sel.options[sel.selectedIndex].value;
	if (navigator.appName=="Netscape")
{
	setTimeout(' document.queryform.p_Query.value=""',100);
}
	document.queryform.submit();
	document.queryform.p_Query.value="";
return false;
}
</script>
</head>
<body>
<!-- START HEADER -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tbody>
    <tr>
      <td width="50%" rowspan="2" height="66" valign="middle"><!-- WELCOME/WORLD
WIDE -->
        <a href="/index.html" onClick="s_objectID='R0:HR:OLOGO';"><img src="http
://oracleimg.com/admin/images/ocom/hp/oralogo_small.gif" alt="Oracle, The World'
s Largest Enterprise Software Company" width="133" height="18" hspace="10" style
="margin-bottom: 5px;" border="0"></a></td>
      <td class="legalese" style="padding: 0px 10px 0px 0px;" align="right" vali
gn="top" width="50%"><div style="vertical-align: bottom;">
          <script language="JavaScript" type="text/javascript">printWelcome()</s
cript>
          &nbsp;&nbsp;|&nbsp;&nbsp;<a href="#" class="legalese" onMouseOver="mvq
MOv();" onMouseOut="mvqMOu();">Worldwide<img src="http://oracleimg.com/admin/ima
ges/ocom/hp/dropdown_arrow.gif" alt="Change Country, Oracle Worldwide Web Sites"
 style="margin-left: 4px;" align="absbottom" border="0" height="14" width="11"><
/a></div>
        <!-- WORLDWIDE pop up menu-->
        <script language="JavaScript" type="text/javascript">worldwideCountries(
)</script>
        <!-- WORLDWIDE popup menu ends here -->
      </td>
    </tr>
    <tr>
      <td class="topTableRight" style="padding: 0px 10px 0px 0px;" align="right"
 height="30" valign="bottom"><form name="searchForm" onSubmit="javascript: retur
n isNotNull(this.keyword.value)" a


SCOTT@orcl_11g> 
 


Re: Html sectioning and CONTAINS query [message #286806 is a reply to message #285175] Mon, 10 December 2007 02:58 Go to previous message
drimades
Messages: 13
Registered: June 2007
Junior Member
That's fine! Thank you!
Previous Topic: Escape OT key words?
Next Topic: contains query
Goto Forum:
  


Current Time: Mon Dec 05 12:42:30 CST 2016

Total time taken to generate the page: 0.19118 seconds