If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Special characters handling in DB2 Text search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-11, 03:41
nitaryann nitaryann is offline
Registered User
 
Join Date: Jul 2011
Posts: 3
Special characters handling in DB2 Text search

Dear All, Am using DB2 9.7 express-c on ubuntu 10.04 and using DB2 Text search over XML documents in my application.

My problem is with handling of special characters(~ { } { }( ) : ! = && || - etc.) within search query.DB2 documentation tells to escape special characters with \ i.e. Use \ so that special characters are analyzed as part of the query.As an example, to return documents that contain (1+1):2 search query should be \(1\+1\)\:2

But DB2 is ignoring all escaped characters instead of considering them in search query i.e. searching for ~abc(Search Query \~abc) returns documents containing any special character before abc like !abc, (abc , :abc !!

This is my search query for above search(searching ~abc)

"xquery <Documents>{
for $i in db2-fn:sqlquery("SELECT DOCUMENT FROM SPEC_DOCS WHERE CONTAINS(DOCUMENT,'@xpath:''/Document/General_Description//Spec[. contains (""\\~abc"")]''') = 1") return <Document>
{$i/Document/General_Description}
</Document>
}</Documents>"

Is there any mistake in above query ? Or is there any specific configuration for this in DB2 Text search ?

Extending the above case, if i search only any escaped special character e.g. \~ , \: , DB2 is returning all documents which again suggests that escaped characters are just ignored in DB2 text search.

Please guide.
Reply With Quote
Reply

Tags
db2 text search

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On