3 Replies Latest reply on Aug 27, 2012 7:57 AM by Gwydion

    Question regarding ctx_doc.snippet


      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.