Using synonyms in the search for name

Hello

I try to use synonyms in an oracle namesearch. Set up a seqarch name as in the second example described in the developer's guide to the oracle text to http://download.oracle.com/docs/cd/E18283_01/text.112/e16594/search.htm application

Now the name, for I am looking can hold one '&', for example 'B & V '.

I would like to find this text when I enter "B & V", B & V' or 'B and V.

I found a thread on how to set up a thesaurus with synonyms for '&' and 'and' to 'and' and ampersand or special characters

Now I'm wondering how to combine this.

Thanks for the help in advance,
Dirk

Your change was correct and it works. For reserved words in the braces enclosing aims to tell Oracle Text as text rather than apply the special meaning they have as reserved words. Since "und" is not a reserved word, it didn't need to be escaped by placing braces. When you set "&", then "und" synonymously as you did the search for 'B und V' correctly found "B and V, as in the modified below demo. In this particular case, the search might work without applying the format_string, but you need to keep it in the query so that it is applied to these values in need, for example, if you searched for "B & V' or 'B & V".

SCOTT@orcl_11gR2> create table emp (
  2        first_name    varchar2(30),
  3        middle_name   varchar2(30),
  4        last_name     varchar2(30),
  5        email            varchar2(30),
  6        phone            varchar2(30));

Table created.

SCOTT@orcl_11gR2> -- added row of data:
SCOTT@orcl_11gR2> set define off
SCOTT@orcl_11gR2> insert into emp values
  2  ('Jane', 'Doe', 'B & V', '[email protected]', '321-654-0987');

1 row created.

SCOTT@orcl_11gR2>
SCOTT@orcl_11gR2> create or replace procedure empuds_proc
  2       (rid in rowid, tlob in out nocopy clob) is
  3         tag varchar2(30);
  4         phone varchar2(30);
  5  begin
  6    for c1 in (select FIRST_NAME, MIDDLE_NAME, LAST_NAME, EMAIL, PHONE
  7              from emp
  8              where rowid = rid)
  9    loop
 10         tag :='';
 11         dbms_lob.writeappend(tlob, length(tag), tag);
 12         if (c1.EMAIL is not null) then
 13             dbms_lob.writeappend(tlob, length(c1.EMAIL), c1.EMAIL);
 14         end if;
 15         tag :='';
 16         dbms_lob.writeappend(tlob, length(tag), tag);
 17         tag :='';
 18         dbms_lob.writeappend(tlob, length(tag), tag);
 19         if (c1.PHONE is not null) then
 20           phone := nvl(REGEXP_SUBSTR(c1.PHONE, '\d\d\d\d($|\s)'), ' ');
 21           dbms_lob.writeappend(tlob, length(phone), phone);
 22         end if;
 23         tag :='';
 24         dbms_lob.writeappend(tlob, length(tag), tag);
 25         tag :='';
 26         dbms_lob.writeappend(tlob, length(tag), tag);
 27         if (c1.FIRST_NAME is not null) then
 28           dbms_lob.writeappend(tlob, length(c1.FIRST_NAME), c1.FIRST_NAME);
 29           dbms_lob.writeappend(tlob, length(' '), ' ');
 30         end if;
 31         if (c1.MIDDLE_NAME is not null) then
 32           dbms_lob.writeappend(tlob, length(c1.MIDDLE_NAME), c1.MIDDLE_NAME);
 33           dbms_lob.writeappend(tlob, length(' '), ' ');
 34         end if;
 35         if (c1.LAST_NAME is not null) then
 36           dbms_lob.writeappend(tlob, length(c1.LAST_NAME), c1.LAST_NAME);
 37         end if;
 38         tag :='';
 39         dbms_lob.writeappend(tlob, length(tag), tag);
 40       end loop;
 41    end;
 42  /

Procedure created.

SCOTT@orcl_11gR2> show errors
No errors.
SCOTT@orcl_11gR2> begin
  2    ctx_ddl.create_preference('empuds', 'user_datastore');
  3    ctx_ddl.set_attribute('empuds', 'procedure', 'empuds_proc');
  4    ctx_ddl.set_attribute('empuds', 'output_type', 'CLOB');
  5  end;
  6  /

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> begin
  2    ctx_ddl.create_section_group('namegroup', 'BASIC_SECTION_GROUP');
  3    ctx_ddl.add_ndata_section('namegroup', 'fullname', 'fullname');
  4    ctx_ddl.add_ndata_section('namegroup', 'phone', 'phone');
  5    ctx_ddl.add_ndata_section('namegroup', 'email', 'email');
  6  end;
  7  /

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> begin
  2    ctx_thes.create_thesaurus ('nicknames');
  3    ctx_thes.create_relation ('nicknames', 'John', 'syn', 'Jon');
  4  end;
  5  /

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2>
SCOTT@orcl_11gR2> -- added synonyms to thesaurus:
SCOTT@orcl_11gR2> begin
  2    ctx_thes.create_relation ('nicknames', '&', 'syn', 'and');
  3    ctx_thes.create_relation ('nicknames', '&', 'syn', 'und');
  4  end;
  5  /

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2>
SCOTT@orcl_11gR2> begin
  2       ctx_ddl.create_preference('NDATA_WL', 'BASIC_WORDLIST');
  3       ctx_ddl.set_attribute('NDATA_WL', 'NDATA_ALTERNATE_SPELLING', 'FALSE');
  4       ctx_ddl.set_attribute('NDATA_WL', 'NDATA_BASE_LETTER', 'TRUE');
  5       ctx_ddl.set_attribute('NDATA_WL', 'NDATA_THESAURUS', 'NICKNAMES');
  6       ctx_ddl.set_attribute('NDATA_WL', 'NDATA_JOIN_PARTICLES',
  7        'de:di:la:da:el:del:qi:abd:los:la:dos:do:an:li:yi:yu:van:jon:un:sai:ben:al');
  8  end;
  9  /

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> create index name_idx on emp (first_name)
  2  indextype is ctxsys.context
  3  parameters
  4    ('datastore  empuds
  5        section    group namegroup
  6        wordlist   ndata_wl');

Index created.

SCOTT@orcl_11gR2>
SCOTT@orcl_11gR2> -- added function to format search string:
SCOTT@orcl_11gR2> create or replace function format_string
  2    (p_string in varchar2)
  3    return varchar2
  4  as
  5    v_string     varchar2 (32767) := ' ' || p_string || ' ';
  6  begin
  7    -- add extra spaces around ampersand:
  8    v_string := replace (v_string, '&', ' & ');
  9    -- remove duplciate spaces:
 10    while instr (v_string, '  ') > 0
 11    loop
 12        v_string := replace (v_string, '  ', ' ');
 13    end loop;
 14    -- add { and } around each reserved word:
 15    for r in
 16        (select keyword,
 17             ' ' || keyword || ' ' keyword2
 18         from      v$reserved_words)
 19    loop
 20        v_string := replace (upper (v_string), r.keyword2, ' {' || r.keyword || '} ');
 21    end loop;
 22    return ltrim (rtrim (v_string));
 23  end format_string;
 24  /

Function created.

SCOTT@orcl_11gR2> show errors
No errors.
SCOTT@orcl_11gR2> -- example of usage of function:
SCOTT@orcl_11gR2> select format_string ('B und V') from dual;

FORMAT_STRING('BUNDV')
--------------------------------------------------------------------------------
B UND V

1 row selected.

SCOTT@orcl_11gR2>
SCOTT@orcl_11gR2> -- query modified to apply foramt_string function to :name variable:
SCOTT@orcl_11gR2> var name varchar2(80);
SCOTT@orcl_11gR2> exec :name := 'B und V'

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> column first_name  format a10
SCOTT@orcl_11gR2> column middle_name format a11
SCOTT@orcl_11gR2> column last_name   format a9
SCOTT@orcl_11gR2> column phone          format a12
SCOTT@orcl_11gR2> column email          format a22
SCOTT@orcl_11gR2> select first_name, middle_name, last_name, phone, email, scr
  2  from   (select /*+ FIRST_ROWS */
  3                first_name, middle_name, last_name, phone, email, score(1) scr
  4            from   emp
  5            where  contains
  6                  (first_name,
  7                   'ndata (phone,'       || format_string (:name) || ') OR
  8                 ndata (email,'       || format_string (:name) || ') OR
  9                 ndata (fullname,' || format_string (:name) || ')',
 10                   1) > 0
 11            order  by score (1) desc)
 12  where  rownum <= 10;

FIRST_NAME MIDDLE_NAME LAST_NAME PHONE        EMAIL                         SCR
---------- ----------- --------- ------------ ---------------------- ----------
Jane       Doe         B & V     321-654-0987 [email protected]           97

1 row selected.

SCOTT@orcl_11gR2>

Tags: Database

Similar Questions

  • I have a new time capsule airport. How to limit the search for who can use the time capsule backup process?

    I have a new time capsule airport. How to limit the search for who can use the time capsule backup process?

    Set a password to disk... disk tab in the utility... and just give to those you want to use the TC...

  • Stop the search for the missing files from LabVIEW

    Is there a way to prevent the search for lack of screws LabVIEW? If I load a VI and one of its dependencies is spent, I want LabVIEW to fail immediately and to wonder where is the file.

    What version of LabVIEW are you using?

    Just hit ignore.  It stops to load files that it cannot find and load than it can.

  • My computer (explorer.exe) continues the search for readers/records.

    Hi experts, I need help on my PC.
    After working with my PC for several hours and minutes when I click/Open 'My Computer' it continues the search for my hard drives and folders in libraries, favorite & computer. He just continues to research and does not display my partition/HARD drive. http://i793.Photobucket.com/albums/yy217/aznix2020/Untitled.PNG
    However, its not freezing or hang up and I can always open my drives/folders by using the command run and after a while it will work fine again.
    Is not a serious problem at the moment because it works well after a while but it's a hassle.
    Also im wondering if this is my drive display relationships safely remove HARD in the options in the task bar. Although the option remove appear for less than a month before I encountered this problem.
    My PC is win7 32 bit sp1. Thanks in advance.

    This problem can be caused by a video driver obsolete or damaged, file system on your PC can be damaged or do not correspond with other files and certain applications or services that are running on your computer may be responsible for Windows Explorer to stop working.

    Refer to the following suggestion and check the status of the issue.

    Install the following update and check if that helps

    Windows Explorer may hang in Windows 7 or in Windows Server 2008 R2.

    https://Support2.Microsoft.com/kb/2515325?WA=wsignin1.0

    If the problem persists, see the suggestions mentioned in the following and check the status of the issue

    Error: Windows Explorer has stopped working.

    http://support.Microsoft.com/kb/2694911

    Note: Before you perform an upgrade in-place, you must be prepared for the worst scenarios that led to your existing data on your computer being deleted. These data include data personal, settings, information about the hardware and software drivers. In case of a worst case scenario, you may have to reinstall all the programs. Make sure that you back up personal data to disks or other external storage devices before performing an upgrade on the spot.

    Note: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    Important: System Restore will return all system files not as documents, email, music, etc., to a previous state. These files of types are completely affected by the restoration of the system. If it was your intention with this tool to recover a deleted file to non-system, try using a file instead of system restore recovery program.

    Please let us know if you need assistance.

  • e-mail Outlook 2013 index is not in the search for a window 7

    Dear all

    Research of a window does not work correctly.
    My emails are not yet indexed and watch not when he search with the search for a window
    Please help me what I can do to fix this
    Thanks in advance
    RAM kishanso

    http://answers.Microsoft.com/en-us/Windows/wiki/Windows_7-files/a-guide-to-using-Windows-search-two-alternatives/2ec3ce7e-e7e3-4EBF-85f8-1263ecdc99bc

  • We try to use Adelle unless the police for our website - link provided goes to the blank page

    We try to use Adelle without the police for our Web site.  I have provided developers with the following instructions of Typekit:

    ____________________

    Install JavaScript

    Copy the code below and paste it into the pages on dev.certifiedalarms.com/ where fonts and settings of your Certified Development Site kit will be used. Make sure it's in the < head > tag.

    "< script src ="https://use.typekit.net/dze4kfy.js"> < / script >.

    < script > try {Typekit.load ({async: true}) ;} catch (e) {} < /script >}

    In your CSS with font family names

    In addition to using the selectors to tell Typekit where to apply this font, you can use the font directly in your CSS rules following font family values:

    "adelle - without.

    Here is an example:

    H1 {}

    do-family: "adelle - without";

    }

    You can also include a policy of aid for older browsers by listing after the Typekit font family values. Here is an example of this:

    H1 {}

    do-family: "adelle - without", without serif.

    }

    ____________________

    Developers do not have to operate this policy.  Specifically, the web link ttps://use.typekit.net/dze4kfy.js's not going anywhere but a blank page.  We want to use this font and would appreciate any help to make it work on our site.

    Hi Tomm,

    I responded to an email on the subject but thought I'd post here for others.

    This kit has not yet been published. You can publish the kit the Kit Editor and that should solve the problem.

    Let me know if you have any other questions.

    See you soon,.

    Benjamin

  • I want to uninstall a toolbar that has been the result of the search for something specific

    Hello

    I want to uninstall a toolbar that has been the result of the search for printable piano music.
    I uninstalled the stuff accompanying this research but I can't get rid of the toolbar. Can I just download an another toolbar as C.NET or what?

    I have a Dell dimension 4700 desktop, XP and I have ' yet to learn through this forum help and everyone.

    Thank you

    Gina Davis

    Original title: how to uninstall toolbat Inbox

    (IE unknown version)

    Hello

    Tools are what bar you referring? That's a browser or another program?


    Method 1:
    Run this fixit to remove it completely.

    http://support.Microsoft.com/mats/Program_Install_and_Uninstall/

    Method 2:
    You can uninstall the toolbar by following the steps below:
    a. open your Internet browser.
    b. click on 'Tools' then 'Add-ons' in IE; Click on "Tools" and "Manage Add-ons."
    c. find the add-on "Toolbar" in the list of available modules.
    d. remove the add-on toolbar in Internet Explorer, select the toolbar and click "disable".
    If you want to remove the toolbar, you can do this by uninstalling it in Add or remove programs.


    Also visit these links to learn more:
    http://TechNet.Microsoft.com/en-us/magazine/dd364987.aspx
  • Windows 7 continues the search for updates

    Recently, I have restored my laptop to factory settings, and after you install the service pack 1 update, this does not block the search for updates.  I tried everything on this site but without success.  Help, please.  Thank you.

    The installation of the plant is the worst possible Windows, that no tech fan would go because of the bloatware and installation utility factory duplicate that interfere with better integrated in the operating system versions.  Corruption as it is so just wait until you make a clean reinstall Windows 7 .

    If you want to try to wrestle with the factory install, so first thing I "d to recover some lost performance is Clean Up Factory Bloatware. "  It also checks and fix the integrity of the installation itself, which is not only limited but damaged by bloatware.

    Then, if the problem run the troubleshooting Windows Update - Microsoft Windows Help tool

    Then, try to Reset Windows Update components.

    Finally, as a last resort, run the System Update tool .

    Let us know how it goes and if there are any questions or problems.

  • I used up to the allocation for the region 1 & 2 DVD for help. stuck on region 1 now. I need to use the two regions for my DVD. Help, please. Beryl

    I used up to the allocation for the region 1 & 2 DVD for help. Stuck on region 1 now.  I need to use the two regions for my DVD. Help, please. Beryl.

    It isn't a MS solution, there are solutions to third parties not supported by MS

  • Can I use pictures from the reserve for commercial use for my members to do with.  We would not sell the photos but the use for commercial use.

    Can I use pictures from the reserve for commercial use for my members to do with.  We would not sell the photos but the use for commercial use. (the 29.99 price months?)

    Thank you.

    Barbara

    In your case you will very likely get extended licenses for images from Fotolia.com otherwise you would have to buy a new license for each Member who has access to use the weather picture they actually use it or not...

  • has someone at - he found a solution to the search for global marker?

    has someone at - he found a solution to the search for global marker?

    the glaring omission of global search for markers - or exclusion of metadata to the project search function marker - is a big handicap for any project of long form doc.

    Is there a work around or maybe a plan to remedy this bizarre situation in an upgrade?

    big fan of the first, and even if there is plenty of downturns, it seems as if there is always planned if solutions non-existent

    Thank you!

    Hi Charliepus,

    Sorry about that. Create a feature here: http://adobe.ly/feature_request

    Thank you
    Kevin

  • When you use the search for a window, the files are not listed in the search index

    Original title: question of Windows search

    When you use windows search, records that are not not in the search index are searced. Why?

    Hello

    1. What is the operating system installed on your computer?

    2 are there any changes made recently to the computer?

    Improve Windows searches using the index: frequently asked questions: http://windows.microsoft.com/en-US/windows7/Improve-Windows-searches-using-the-index-frequently-asked-questions

    You can also check:

    Reconstruction of Index of Microsoft Windows 7 search: http://windows.microsoft.com/en-US/windows7/Change-advanced-indexing-options

    Advanced Tips for searching in Windows

    http://Windows.Microsoft.com/en-us/Windows7/advanced-tips-for-searching-in-Windows

    I hope this helps.

  • The search for file names with a tilde ("" ~ ")

    In Windows Explorer, how can I search for filenames containing a tilde? I tried the name: ~, but this seems to find all the files. I tried going to ADVANCED search and specifying, ~ * ~ *, ' ~ ', etc. and he always seems to find all files. "It's a drag, since all these tilde files are probably temporary which can be deleted.

    Sachelis Hello,

    Please see this recent thread:

    http://social.answers.Microsoft.com/forums/en-us/vistafiles/thread/f8266844-292d-4609-915F-43a99c58830e/#299602a9-5954-49cd-8873-363bc3679381

    Mr. Doug in New Jersey

  • Is anyone able to use model filters to search for in the search dialogue files?

    JDev 11.1.1.6

    When this option is checked, regardless of filter templates (included or excluded), the search does not find anything in the search path.

    Tried with all possible models.

    Even if there is no trend at all, the search does not work.

    In fact, research only works if this option is not checked.

    Any advice?

    You can select the types of required file Types of files (files in use Types). For the model, you can use

    Exclude the * / classes / *.

    Exclude the **/.svn/*

    Include *.

    Arun-

  • How to change the address bar of search engine uses when you type in the search for something that is not Google

    I left all the Google services currently, I used Gmail, Chrome, etc... due to the recent sale of information to the Gov't and what not and even though she may or may not be true I'm sure and switched to Firefox and a different email provider. In any case so far, I like Firefox I use DuckDuckGo as my current default search and I would use as my search engine when I type a search in the address bar, by default it is Google, how can I change to a search provider I want as DuckDuckGo?

    Hello

    If you have installed DuckDuckGo on Firefox, you can follow these steps:

    1. Type of topic: config in the address bar.
    2. A warning appears, click on "I'll be careful, I promise!
    3. Type browser.search.defaultEngine in the search at the top of the page box.
    4. Double-click the item that appears.
    5. Set the value to DuckDuckGo or any search engine you want to use (the case I think).

    (I have attached a screenshot).

Maybe you are looking for

  • my web page of talktalk email suddenly reduced size yesterday and I can't get it back.

    My email web page suddenly size reduced yesterday when I was typing an email. The page is now almost unreadable and the messages are nearly illegible, as the font size is so small on the page. I think that I pressed something on the keyboard of the l

  • Auto-completion in the address bar does not work well

    Usually, I always opened in the browser 2 tabs: gmail and hotmail. When I open a tab mew and I start typing in one'm ' to connect to facebook and open my page the mouse the automatic completion feature removes follow her ' I have typed and replaces i

  • Bass disappears in Apple Earpods when moving cord

    As the title says, my Earpods of Apple acted for several days. I usually listen to music with my earpods as my phone is in my pocket, and sometimes the sound becomes really distorted, almost as if the bass is be cut off. After having poking around, I

  • Repair hard disk?

    I have Drive Genius installed on my mini. I get the following message: incorrect # file hard links. Volume was found damaged and must be repaired. I can do a volume control, but I am unable to do a repair. In the new operating system, disk utility is

  • How can I change the default startup screen in Media Player 9, to the media library

    After reformatting my HD and reinstall a bunch of stuff, I've updated the Media Player 9.  I am running XP Pro and want to know how I can change the default to the media library start screen?  Much nicer visually that always have to play a very, very