This discussion is archived
3 Replies Latest reply: Aug 27, 2012 12:57 AM by Gwydion RSS

Question regarding ctx_doc.snippet

Gwydion Newbie
Currently Being Moderated

I have an xml document like
  <B>foo1 bar</B>
  <B>foo2 bar</B>
  <B>foo3 bar</B>
and I want to extract a snippet that consists only of the content of a B Element that contains the search term "foo2", i.e. it should return
<b>foo2</b> bar
However, If I call ctx_doc.snippet like
select ctx_doc.snippet(
   index_name  => 'TEST_INDEX',
   textkey        => 'PrimaryKey',
   text_query   => 'foo2 within B'
) from dual;
it returns
foo1 bar  <b>foo2</b> bar  foo3 bar
I know that I can restrict the snippet to a certain length, but it is possible to restrict the snippet to the content of tag which is mentioned in the search expression?
I could add some artificial delimiter strings to my tags and perform some filter logic afterwards, but that would be rather complicated.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points