Oracle Text HASPATH QUERY Returns Wrong Results when using Attributes (Doc ID 1361762.1)

Last updated on FEBRUARY 08, 2017

Applies to:

Oracle Text - Version: 10.2.0.4 and later   [Release: 10.2 and later ]
Information in this document applies to any platform.

Symptoms

Using HASPATH on attributes gives wrong result.
It seems that it is "OR"-ing the predicate instead of "AND"-ing it

The following demonstrates the issue:
When you execute the uploaded file, you'll see that there's 1 table created that holds just 1 record.

This record holds this xml:

<Test>
<Client id="1">
<Info infoid="1"/>
</Client>
<Client id="2">
<Info infoid="2"/>
</Client>
</Test>

When following statement is executed there should be no records returned, because the condition is not matched. Although, it returns the record.

select main_detail_logging_id, t.xml_data.getstringval() xml_data from TEST_XMLTYPE t
where contains(t.xml_data, 'HASPATH(/Test/Client[@id="1"]/Info[@infoid="2"])') > 0;

Example

set define off;

create table Test_XmlType
(Main_Detail_Logging_Id Number(9)
, XML_Data xmltype)
/

insert into Test_XmlType
(Main_Detail_Logging_Id, XML_Data)
values
(1, xmltype('<Test>
<Client id="1">
<Info infoid="1"/>
</Client>
<Client id="2">
<Info infoid="2"/>
</Client>
</Test>'))
/
Commit
/
-- Create Lexer
begin
ctx_ddl.create_preference ('TEST_XMLTYPE_LEX','BASIC_LEXER');
ctx_ddl.set_attribute ('TEST_XMLTYPE_LEX','SKIPJOINS','''');
end;
/

CREATE INDEX TEST_XMLTYPE_xml ON Test_XmlType (xml_data)
INDEXTYPE IS CTXSYS.CONTEXT
PARAMETERS ('
filter ctxsys.null_filter
section group ctxsys.PATH_SECTION_GROUP
Lexer TEST_XMLTYPE_LEX
stoplist ctxsys.EMPTY_STOPLIST
memory 200M')
/

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms