Unable to use the thesaurus in a relaxation template

I am trying to get a query relaxation template to use the thesaurus but I can't get the syntax correct. Is it possible? If so, please can someone tell me where I'm going wrong?
create table test_table(company_name varchar2(100));
insert into test_table values ('Test Limited');
insert into test_table values ('Test Ltd');
create index idx_test on test_table(company_name) indextype is ctxsys.context;
If my query looks like this:
select company_name, score(1)
from test_table
where CONTAINS (company_NAME,
'<query>
<textquery lang="ENGLISH" grammar="CONTEXT">test ltd
<progression>
<seq><rewrite>transform((TOKENS, “{”, “}”, “ ”))</rewrite></seq>
<seq><rewrite>transform((TOKENS, “!”, “%”, “ ”))</rewrite></seq>
<seq><rewrite>transform((TOKENS, “${”, “}”, “ ”))</rewrite></seq>
<seq><rewrite>transform((TOKENS, “SYN(”, “,legal_form)”, “ ”))</rewrite></seq>
</progression>
</textquery>
<score datatype="INTEGER" algorithm="COUNT"/>
</query>',1)>0;
I get the matching record back
COMPANY_NAME SCORE(1)
Test Ltd 75
But if I move the SYN line to the top like this:
select company_name, score(1)
from test_table
where CONTAINS (company_NAME,
'<query>
<textquery lang="ENGLISH" grammar="CONTEXT">test ltd
<progression>
<seq><rewrite>transform((TOKENS, “SYN(”, “,legal_form)”, “ ”))</rewrite></seq>
<seq><rewrite>transform((TOKENS, “{”, “}”, “ ”))</rewrite></seq>
<seq><rewrite>transform((TOKENS, “!”, “%”, “ ”))</rewrite></seq>
<seq><rewrite>transform((TOKENS, “${”, “}”, “ ”))</rewrite></seq>
</progression>
</textquery>
<score datatype="INTEGER" algorithm="COUNT"/>
</query>',1)>0;
I get an error which I think means that the XML line is not valid:
ORA-29902:error in executing ODCIIndexStart() routine
ORA-20000: Oracle Text error:
DRG-50901: text query parser syntax error on line 1, column 35
What is the correct format for the line that will apply the thesaurus synonym between Limited to LTD?

There are a lot of things that work well individually, but not in combination with one another. It looks like something goes wrong when you try to combine transform with syn. One possible workaround is to use replace to do your own transformation. Please see the reproduction and solution below.
SCOTT@10gXE> -- test environment:
SCOTT@10gXE> create table test_table(company_name varchar2(100));
Table created.
SCOTT@10gXE> insert into test_table values ('Test Limited');
1 row created.
SCOTT@10gXE> insert into test_table values ('Test Ltd');
1 row created.
SCOTT@10gXE> create index idx_test on test_table(company_name) indextype is ctxsys.context;
Index created.
SCOTT@10gXE> EXEC CTX_THES.CREATE_THESAURUS ('legal_form')
PL/SQL procedure successfully completed.
SCOTT@10gXE> EXEC CTX_THES.CREATE_RELATION ('legal_form', 'Limited', 'SYN', 'Ltd')
PL/SQL procedure successfully completed.
SCOTT@10gXE> COLUMN company_name FORMAT A30
SCOTT@10gXE> -- reproduction of problem:
SCOTT@10gXE> select company_name, score(1)
  2  from test_table
  3  where CONTAINS (company_NAME,
  4  '<query>
  5  <textquery lang="ENGLISH" grammar="CONTEXT">test ltd
  6  <progression>
  7  <seq><rewrite>transform((TOKENS, “SYN(”, “,legal_form)”, “ ”))</rewrite></seq>
  8  <seq><rewrite>transform((TOKENS, “{”, “}”, “ ”))</rewrite></seq>
  9  <seq><rewrite>transform((TOKENS, “!”, “%”, “ ”))</rewrite></seq>
10  <seq><rewrite>transform((TOKENS, “${”, “}”, “ ”))</rewrite></seq>
11  </progression>
12  </textquery>
13  <score datatype="INTEGER" algorithm="COUNT"/>
14  </query>',1)>0
15  /
select company_name, score(1)
ERROR at line 1:
ORA-29902: error in executing ODCIIndexStart() routine
ORA-20000: Oracle Text error:
DRG-50901: text query parser syntax error on line 1, column 7
SCOTT@10gXE> -- possible workaround:
SCOTT@10gXE> VARIABLE search_string VARCHAR2(30)
SCOTT@10gXE> EXEC :search_string := 'test ltd'
PL/SQL procedure successfully completed.
SCOTT@10gXE> select company_name, score(1)
  2  from test_table
  3  where CONTAINS (company_NAME,
  4  '<query>
  5  <textquery lang="ENGLISH" grammar="CONTEXT">
  6  <progression>
  7  <seq>' || 'SYN(' || REPLACE(:search_string, ' ', ',legal_form) AND SYN(') || ',legal_form)' || '</seq>
  8  <seq>' || '{'    || REPLACE(:search_string, ' ', '} {')                 || '}'           || '</seq>
  9  <seq>' || '!'    || REPLACE(:search_string, ' ', '% !')                 || '%'           || '</seq>
10  <seq>' || '${'   || REPLACE(:search_string, ' ', '} ${')                 || '}'           || '</seq>
11  </progression>
12  </textquery>
13  <score datatype="INTEGER" algorithm="COUNT"/>
14  </query>',1)>0
15  /
COMPANY_NAME                     SCORE(1)
Test Limited                           75
Test Ltd                               75
SCOTT@10gXE>

Similar Messages

  • Why does iTunes/iPhone 4S insist it can't find a song on my PC or my phone when it is on both? This is resulting in me being unable to use the ringtones I created from these songs, but I can still play the songs.

    OK, so I'm clearly a newb. I thought if I asked a question, it would post, and now I'm being told to post a comment, so I'm asking the same question again. Sorry I sound like an idiot. I'm new to this apple/mac stuff.
    Why does iTunes/iPhone 4S insist it can't find a song on my PC or my phone when it is on both? This is resulting in me being unable to use the ringtones I created from these songs, but I can still play the songs.

    If you have added the ringtone file correctly to iTunes, it will appear under iTunes 'Tones' library.
    If you don't find Tones library in iTunes, go to iTunes menu EDIT/PRFERENCES under GENERAL tab, check the Tones Box under Library source to display Tones library in iTunes.
    iTunes accepts only m4r file as ringtone and has to be less than 40secs.

  • Since upgrading iTunes 10.5.1.42, I have been unable to use the "Advanced - Create iPad or Apple TV Version" to convert movies.

     I have been unable to use the "Advanced - Create iPad or Apple TV Version" to convert my movies for use with my iPad2. The movie will go through the conversion process, and is the correct length, but the video is a black and there is no sound? Has anyone found a similar problem? If so, what can I do to fix the problem? Before I used Handbrake to convert the videos which worked well, but now that is not working either .

    No, there is no direct download link. Those are days of the past, I'm afraid. You may need to reinstall Mavericks.
    Install or Reinstall Yosemite, Mavericks, Mountain Lion, or Lion from Scratch
    Be sure you backup your files to an external drive or second internal drive because the following procedure will remove everything from the hard drive.
    How to Clean Install OS X Yosemite
    OS X Mavericks- Erase and reinstall OS X
    OS X Mountain Lion- Erase and reinstall OS X
    OS X Lion- Erase and reinstall Mac OS X
    Note: You will need an active Internet connection. I suggest using Ethernet if possible
                because it is three times faster than wireless.

  • HT1414 I attempted to update my iphone 3 through I tunes - I think I did a back up on my pc - I am now unable to use the phone at all - it cannot be turned off and seems to be syncing all the time, even when it is not connected to itunes.

    I attempted to update my iphone 3 using itunes.  I'm not certain but I believe I did a backup on my pc first.  I am now unable to use the phone at all - the slide bar won't move and I have a camera icon next to the slide bar which is not responsive.  I have tried to sync and even left the phone connected to the pc overnight. The phone is going flat within a couple of hours and won't stop beeping every few seconds and seems to be syncing all the time, even when disconnected from pc.  I am fearful that I have lost all my contacts - nothing is working - can anyone help - please?

    Try resetting it if you can: hold the on/off and home buttons until you see the Apple logo (ignore the off slider that appears first), then release.  If you can't, try to connect it to iTunes, go to the Summary tab of your sync settings and click Restore to restore it.  If that doesn't work you'll have to force it into recovery mode to restore it as outlined here: http://support.apple.com/kb/ht1808.
    You can check in iTune to see if you have a backup.  They are listed in iTunes>Preferences>Devices.  However, the backup may not bring your contacts back as contacts are only backed up as necessary to preserve the recent call and call favorites lists.

  • Hello, I have a macbook pro late 2011 15 inch with 4 gb ram. My macbook runs extremely slow when logging in after waking up from sleep, locking up and I am unable to use the keyboard. Is there a fix?

    My macbook runs extremely slow when logging in after waking up from sleep, locking up and I am unable to use the keyboard. Furthermore, when just using safari to watch streaming television, my computer gets really slow, and locks up, and the dock appears blank and I sit here frustrated. Anytime i wake up my computer, my keys don't respond and I've waited at most 3 minutes untill i can type in my password. Even sometimes when i type in my password and hit enter, it takes forever to open up my mac. I have barely used any storage in my macbook, since i only use it for college, and I have run clamscan wiht no viruses showing... Any ideas?

    when just using safari to watch streaming television, my computer gets really slow, and locks up, and the dock appears blank
    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, or by a peripheral device. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including sound output andWi-Fi on certain iMacs. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

  • Unable to use the keyboard in XP keys work OK when boot into dos

    Unable to use the keyboard in XP. It was working for over a year OK  with XP running
    keys work OK when I install win98 or use a dos boot disk.
    If I try to reinstall XP I can not use any of keys to input anything.
    Return
    Esc
    CapsLock
    ctrl-alt-del.
    NO KEYS WORK AT ALL OTHER THAN 
    ë à
    I did an upgrade from win98 but that did not work.
    Any ideas

    billwyatt, welcome to the forum,
    I think you forgot to mention which ThinkPad you have. It would be even better if you could post the Type and Model Number as this will help members to hopefully help you. If it ends in CTO please provide some details about the ThinkPad. Please do NOT post your s/n.
    Andy  ______________________________________
    Please remember to come back and mark the post that you feel solved your question as the solution, it earns the member + points
    Did you find a post helpfull? You can thank the member by clicking on the star to the left awarding them Kudos Please add your type, model number and OS to your signature, it helps to help you. Forum Search Option T430 2347-G7U W8 x64, Yoga 10 HD+, Tablet 1838-2BG, T61p 6460-67G W7 x64, T43p 2668-G2G XP, T23 2647-9LG XP, plus a few more. FYI Unsolicited Personal Messages will be ignored.
      Deutsche Community     Comunidad en Español    English Community Русскоязычное Сообщество
    PepperonI blog 

  • Installed the ios 7.0.2 update to my iphone 4, now it is stuck on a screen with itunes icon and power plug.  is this corect? I am unable to use the phone now.  What should i do next? I plug in to itune in my computer and ask me to restore my phone?

    installed the ios 7.0.2 update to my iphone 4, now it is stuck on a screen with itunes icon and power plug. 
    I am unable to use the phone now.  What should i do next? I plug in to itune in my computer and ask me to restore my phone? I will loose all my date?

    I hooked up itune and restore.  after finished restores, it said my phone is in recovery mode and needs to be finish before using itune, my screen still show the itunes icon and power plug

  • We bought an iphone 4s for our daughter. We transfered it to straight talk. She can make calls and text no problem. She can use the WiFi but is unable to use the internet or mms. How do we update the APN?

    We bought an iphone 4s for our daughter. We transfered it to straight talk. She can make calls and text no problem. She can use the WiFi but is unable to use the internet or mms. How do we update the APN?

    To clarify for anyone who is still having any problems doing this.
    1. Unlock your phone with the carrier ( I know the process will work if it is jail broken but I am assuming you dont want to void the warranty on your phone) NOTE: even if you purchased the phone outright at Wal-Mart it is still locked to ATT so you will have to unlock the phone.  If it's already unlocked skip to step 2.  This works and will work even if you update the phone. 
    1a Here is the link to unlock a ATT iphone. Simply follow the instructions https://www.att.com/deviceunlock/client/en_US/
    2. Get a T- mobile SIM. Even if you don't want the service, if you feign interest, they will send you one for free or 99cents. If you need it now you can get one at a T-mobile store too.
    3. Once you have both your Straight talk SIM and your T-mobile SIM follow these instructions:http://www.youtube.com/watch?v=mFFf5uqk18M
    4. If you have any remaining questions look at all the responses posted previously on this thread or check out the Howard Forums Wiki: http://wiki.howardforums.com/index.php/Straight_Talk_iPhone
    Everything should work flawlessly at this point.  If not let me know and I'm happy to help when I can.  I hope this makes doing this very easy for everyone in the future. God Bless -J

  • Why am I unable to use the Adobe Send application

    I am unable to fill in forms, add text or send a form, whereas I used to be able to do this.  I have an Adobe Account with a User ID and password.  Isn't Adobe a Certified Document Service?

    mspacmn wrote:
    Am I unable to use the text messaging feature on my 2014 Honda CRV with my Iphone 6?
    Yes, you are unable to use text messaging feature with your iPhone.
    -> http://owners.honda.com/vehicles/information/2014/CR-V/features/SMS-Text-Message -Function/3
    "The system is currently compatible with select Blackberry® phones with Bluetooth"

  • HT3702 I purchased a book called Activity-based costing for $3.99. I tried to open the file but it said my computer does not have IOS. I have a smartphone and I am unable to view the book. I am requesting since I am unable to use the book activity-base co

    I purchased a book called Activity-based costing for $3.99. I tried to open the file but it said my computer does not have IOS. I have a smartphone and I am unable to view the book. I am requesting since I am unable to use the book activity-base costing, a refund.
    Kevin

    I don't know what you are saying. How do I get my money refunded.

  • I am not getting the verification e mail, for my apple id and unable to use the apple store

    Hi There,
    I am uable to get the verification e mail for my apple id and unable to use the apple store.
    Regards,
    Ameera

    G to appleid.apple.com and then to manage ID and see if you can get the ID working there

  • HT5621 i created a new apple id. The verication email is not send to my email id. So i am unable to use the new apple id

    Hi,
    i created a new apple id. The verication email is not send to my email id. So i am unable to use the new apple id

    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card
    Step 3 is important, no matter whether you do this on a Mac or an iPad / iPhone:
    Important: Before proceeding to the next step, you must download and install a free application. ...
    Important: Before proceeding to the next step, you must download and install the free application by tapping Free followed by tapping Install App. ...

  • Since I've updated to iOS 6 I am unable to use the next/back buttons from Headphone for audio book chapters.

    Since I've updated from iOS 5 to iOS 6 I am unable to use the next/back buttons from Headphone for audio book chapters.
    This is working fine for albums but are broken for audio books.
    The back button refers always to the first chapter of the audio book (very annoying if you are in the middle of an audio book) and the nex button goes one level higher back to the selection of the audio book itself.
    In iOS 5.0 it was still possible to navigate throught the audio book chapters using these buttons.
    This still happens in iOS 6.1.
    Is this a known bug?
    Does any solution exist?
    Thx,
    Oliver

    To gdgmacguy your a f****** idiot for one I'm having the same problem as pennymar. And you tell me to quit whinning. You got more problems then the iOS 6 you did not answer my question nor the other 13 or whatever you replied to within a 30 min time frame. You must got nothing better to do then to harass people and to pretend you know something about apple products. Which you don't from what I've read the other advices you should have gave to other people. But you didn't you replied a question back to the people asking a question. So if your not gonna use these community forums the right way don't use them at all.

  • I've forgotten the answers to my security questions, and for some reasons My rescue email is not active now, I can only access to my primary email, I have just redeemed a $25 gift card this morning, I was unable to use the money now. what should I do?

    I've forgotten the answers to my security questions, and for some reasons My rescue email is not active now, I can only access to my primary email, I have just redeemed a $25 gift card this morning, I was unable to use the money now. what should I do?

    You need to ask Apple to reset your security questions; this can be done by clicking here and picking a method, or if your country isn't listed, filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (110676)

  • HT201303 Why am I unable to use the apple store card  I purchased to purchase a movie or anything else from the iTunes app store???

    WHY AM I UNABLE TO USE THE APPLE STORE CARD I PURCHASED  FROM BEST BUY TO BUY A MOVIE OR ANYTHING ELSE FROM ITUNES OR THE APPLE STORE/

    Apple store gift cards and iTunes gift cards are not interchangeble. They have to be used for the store in which they were purchased.

Maybe you are looking for

  • N95 8GB Video Manager "NOT CONVERTING"

    My NSeries Video Manager for N95 8GB does not seem to be able to convert any video file. What's exactly happening is that after I've searched a folder and found the video files, whatever video type I choose (whether it's an .avi, or.mpg or.mov file)

  • Freeze, freeze, freeze  HELP

    My cursor moves but doesn't affect anything. I click on the icons and nothing happens, i can't gtet anything to work. I've restarted a few times, but still nothing. Anybody???? Help??????

  • Transferring pictures to the camera roll to restore it on the "places" app.

    Hello, I really love the "Places" app on the iphone whre all my pictures get automatically sorted to where the picture was taken. Unfortunately, I transferred some of my holiday pictures to my laptop and the pictures were removed from from the camera

  • Temporarily prevent login items while using FileVault2

    Hi everyone, in the past you could hold down shift while logging in and this would temporarily disable your login items so no windows would pop up. This still works in 10.9, but only when I am on the regular login screen. I am using FileVault so I ha

  • Not able to include std lib

    Error : Could not open include file<cwchar>. Where can i find this file in solaris 10.any one please help.