Wild search in the name column

Hello

IAM using oracle 11.2

IAM having a query that finds a particular part of the word name
for example

CREATE TABLE TEST123
(type1, varchar2 (10))
LIST1 VARCHAR2 (10),
NAME VARCHAR2 (302).
NAME2 VARCHAR2 (500),
ANAG_NAME VARCHAR2 (2000))



SELECT *.
OF test123
WHERE ='s TYPE1' AND
(LIST1 = "CL"
AND (NAME2 = "AIILN" AND)
(instr (NAME, 'IAN') > 0 AND instr (NAME, 'LI') > 0))
OR LIST1 = 'TT '.
AND (NAME2 = "AIILN" AND)
(instr (ANAG_NAME, ' un ') > 0 AND instr (ANAG_NAME, "L") > 0))
)

the table can contain 2 million records.

I want to replace it with the index ctxsys.
because research is a wildcard search
If use to create indexes ctxsys.context I have to use the CONTAINS clause to find records that I have to use %
and if I create index ctxsys.ctxcat I use CATSEARCH to search for record, I used ' *'


but both takes more time...
However, an error occurs.

Can someone give some suggestion...

Thank you
user

Published by: user9080289 on June 22, 2012 12:10

In general, you can create a CONTEXT index on a column, then use CONTAINS instead of the Instr. You can also create a MULTI_COLUMN_DATASTORE on several columns and use a sort of GROUP of SECTIONS, so that you can use a CONTAINS clause and with an index affected research in several columns. You can also use FILTER BY in your index creation, so that you can include columns structured in your index, so that you can use SURLABASEDESDONNEESDUFABRICANTDUBALLAST in your CONTAINS clause, so that your entire query uses one index. You can also use SUBSTRING_INDEX to increase lookup speed when you use wildcard characters. You may also need to increase the WILDCARD_MAXTERMS. If you are looking for a string that is separated by spaces, punctuation or some other delimiter, you don't need wildcards. However, if you search for a string in a Word, then you need wildcards. If you are looking for short strings, then you must be sure to only use a list of empty words that does not include them. If your channels are too short, then you are likely to exceed the WILDCARD_MAXTERMS, unless set you it to 0, while there is no limit, but then this type of query can be very slow and consume a lot of resources. Please see the demo below. I added a column to create the index on, but you can create index on a column of text. The columns that are searched are determined by the columns in the store of data and filtering, not the column in the index in created the.

-test environment consisting of table, data and similar to the original query:

SCOTT@orcl_11gR2> -- table:
SCOTT@orcl_11gR2> CREATE TABLE TEST123
  2    (type1        varchar2(10),
  3       LIST1        VARCHAR2(10),
  4       NAME        VARCHAR2(302),
  5       NAME2        VARCHAR2(500),
  6       ANAG_NAME  VARCHAR2(2000),
  7       names        VARCHAR2(1))
  8  /

Table created.

SCOTT@orcl_11gR2> -- data:
SCOTT@orcl_11gR2> INSERT ALL
  2  INTO test123 VALUES ('s', 'CL', 'IAN LI', 'AIILN', NULL, NULL)
  3  INTO test123 VALUES ('s', 'TT', NULL, 'AIILN', 'AN L', NULL)
  4  INTO test123 VALUES ('s', 'CL', 'IANLI', 'AIILN', NULL, NULL)
  5  INTO test123 VALUES ('s', 'TT', NULL, 'AIILN', 'ANL', NULL)
  6  INTO test123 VALUES ('s', 'CL', 'LIIAN', 'AIILN', NULL, NULL)
  7  INTO test123 VALUES ('s', 'TT', NULL, 'AIILN', 'LAN', NULL)
  8  SELECT * FROM DUAL
  9  /

6 rows created.

SCOTT@orcl_11gR2> -- query similar to original:
SCOTT@orcl_11gR2> COLUMN name        FORMAT A10
SCOTT@orcl_11gR2> COLUMN name2        FORMAT A10
SCOTT@orcl_11gR2> COLUMN anag_name FORMAT A10
SCOTT@orcl_11gR2> SELECT *
  2  FROM   test123
  3  WHERE  type1 ='s'
  4  AND    ((list1 = 'CL'
  5             AND name2 = 'AIILN'
  6             AND INSTR (name, 'IAN') > 0
  7             AND INSTR (name, 'LI') > 0)
  8            OR
  9            (list1 = 'TT'
 10             AND name2 = 'AIILN'
 11             AND INSTR (anag_name, 'AN') > 0
 12             AND INSTR (anag_name, 'L') > 0))
 13  /

TYPE1      LIST1      NAME       NAME2      ANAG_NAME  N
---------- ---------- ---------- ---------- ---------- -
s          CL         IAN LI     AIILN
s          TT                    AIILN      AN L
s          CL         IANLI      AIILN
s          TT                    AIILN      ANL
s          CL         LIIAN      AIILN
s          TT                    AIILN      LAN

6 rows selected.

-index multi_column_datastore, list of words and text:

SCOTT@orcl_11gR2> -- multi_coumn_datastore and wordlist:
SCOTT@orcl_11gR2> BEGIN
  2    -- multi_column_datastore:
  3    CTX_DDL.CREATE_PREFERENCE ('test123_mds', 'MULTI_COLUMN_DATASTORE');
  4    CTX_DDL.SET_ATTRIBUTE ('test123_mds', 'COLUMNS', 'name, name2, anag_name');
  5    -- worlist:
  6    CTX_DDL.CREATE_PREFERENCE ('test123_wl', 'BASIC_WORDLIST');
  7    CTX_DDL.SET_ATTRIBUTE ('test123_wl', 'SUBSTRING_INDEX', 'TRUE');
  8    CTX_DDL.SET_ATTRIBUTE ('test123_wl', 'WILDCARD_MAXTERMS', 50000);
  9  END;
 10  /

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> -- text index using FILTER BY, multi_column_datastore, section group, wordlist:
SCOTT@orcl_11gR2> CREATE INDEX test123_idx
  2  ON test123 (names)
  3  INDEXTYPE IS CTXSYS.CONTEXT
  4  FILTER BY type1, list1
  5  PARAMETERS
  6    ('DATASTORE     test123_mds
  7        SECTION GROUP     CTXSYS.AUTO_SECTION_GROUP
  8        WORDLIST     test123_wl
  9        STOPLIST     CTXSYS.EMPTY_STOPLIST')
 10  /

Index created.

-query using CONTAINS and SURLABASEDESDONNEESDUFABRICANTDUBALLAST with a single hit index:

SCOTT@orcl_11gR2> SET AUTOTRACE ON EXPLAIN
SCOTT@orcl_11gR2> SELECT *
  2  FROM   test123
  3  WHERE  CONTAINS
  4             (names,
  5              'SDATA (type1 = ''s'')
  6            AND AIILN WITHIN name2
  7            AND ((SDATA (list1 = ''CL'')
  8                  AND (%IAN% AND %LI% WITHIN name))
  9                 OR
 10                 (SDATA (list1 = ''TT'')
 11                  AND (%AN% AND %L% WITHIN anag_name)))') > 0
 12  /

TYPE1      LIST1      NAME       NAME2      ANAG_NAME  N
---------- ---------- ---------- ---------- ---------- -
s          CL         IAN LI     AIILN
s          TT                    AIILN      AN L
s          CL         IANLI      AIILN
s          TT                    AIILN      ANL
s          CL         LIIAN      AIILN
s          TT                    AIILN      LAN

6 rows selected.

Execution Plan
----------------------------------------------------------
Plan hash value: 3044757981

-------------------------------------------------------------------------------------------
| Id  | Operation                   | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |             |     1 |  1435 |     4   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| TEST123     |     1 |  1435 |     4   (0)| 00:00:01 |
|*  2 |   DOMAIN INDEX              | TEST123_IDX |       |       |     4   (0)| 00:00:01 |
-------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access("CTXSYS"."CONTAINS"("NAMES",'SDATA (type1 = ''s'')            AND
              AIILN WITHIN name2            AND ((SDATA (list1 = ''CL'')                  AND
              (%IAN% AND %LI% WITHIN name))                 OR                 (SDATA (list1 =
              ''TT'')                  AND (%AN% AND %L% WITHIN anag_name)))')>0)

Note
-----
   - dynamic sampling used for this statement (level=2)

SCOTT@orcl_11gR2>

Tags: Database

Similar Questions

  • You want to search ONLY the names of files in the Explorer of Windows 7?

    I want to usually just looking for a word "in a file name& record' - and can often give a date of the range. In the Explorer of Windows 7, as soon as I type the word, I get all the files that contain the word in the content, as well.  How can I have search only the file or folder name?

    I also don't use 'my documents' or 'libraries '... I create my own subfolders - and usually on a stick... disc so I don't really understand "crawler" or if it is relevant to how I organize my files.

    I miss the Windows XP search feature in the Explorer of Windows 7!

    No need for anything that it is complicated.  Simply type what you are looking for.  If it's in the name of the file, these results will be returned first, above all results corresponding to your searchinside of the file term.  Easy.

    Without indexing places such as stick readers can always be sought, but take a little more time looking for (like XP).

    If it solves your problem, click on the link "Propose as answer" below and vote as useful by clicking on the green triangle for the lelft. Thank you!

  • Adding keywords to a subject causes the search return the names of file instead of topic titles

    When I search for a term in my WebHelp Pro project, matching topics are displayed by filename if the subject has anything in its properties > General > keywords field, and are presented by topic title if there is no defined keywords for the subject.

    I confirmed this behavior by adding and deleting keywords from subjects and looking alternately to be shown in the search by file name or title of the topic.

    Obviously, I want stories to be displayed by topic titles in search results no matter whether they have keywords assigned or not.

    Any idea of what this could be the cause? Is this a known bug?

    Here is some additional information. This problem occurs, these four conditions must be met:

    1. The subject must have manually added keywords in properties > general > keywords field.
    2. The title of the topic and the name of the file must be different.
    3. We have to search among keywords added in step 1.
    4. Occurs in WebHelp Pro when published to a remote server.

    Interviews with Adobe today are not conclusive, but it seems that it was an unknown bug. Maybe I'll get a free t-shirt or something.

    Hi Rocky,

    Journal on Robohelp Configuration Manager.

    Uncheck the option "re-indexing of documents to the server.

    Republish and check. If the problem exists, try to restart the Apache/Tomcat server.

    This should work for you.

    Kind regards

    Robbie

  • In the name column DataGrid

    Hello

    I fill a DataGrid with JSON data that comes from a mysql query.  I was wondering if it is possible to say a piece of JSON data to one column other than the name there?

    My JSON data comes with short names...

    [{'gID': 'Rock', 'vID': 'Pub Darby', 'Greek': 'Yes'}]

    and I load in my dataGrid data provider...

    myDG.dataProvider = new DataProvider (myJSON);

    Currently, my columns must be named...

    gID, vID, and Greek

    for the above data is filled.  Is it possible to have more meaningful column names, while keeping the abbrieviated form in the JSON data?

    for example...

    STYLE OF CONCERT, VENUE, CAN BE SAVED

    or have I not choice but to make the full names, part of the JSON as...

    [{'CONCERT STYLE': 'Rock', 'PLACE': 'Pub Darby', 'CAN BE SAVED': 'Yes'}]

    Thank you

    Shaun

    of course, you can create a dataprovider that suits your needs:

    var obj:Object = {'gID': 'GIG STYLE', 'vID': "PREGNANT", "Greek:"CAN BE SAVED "};

    var dpA:Array = [];

    for (var i: int = 0; i<>

    for (var s:String in {myJSON [i])}

    dpA.push({obj[s]:myJSON[i][s]});)

    }

    }

    myDG.dataProvider = new DataProvider (dpA);

  • Search for the name and part number of the CPU or fan of radiator for Pavilion m9300t Desktop fan.

    Looking for a part number and the name of processor or fan for desktop computer HP Pavilion m9300t radiator fan. Noise one supplied with the PC is a terrible grinding until the system stops and dies.

    Hello

    I highly recommend not to turn on your computer until the fan is replaced.

    Is your PC still under warranty?

    You may not use the original part.

    All you need is to have a CPU for a socket 775 CPU fan (LGA775). I recommend that you choose 90-92mm fan size due to the limitations of the original business space.

    You will also need thermal interface (I recommend Arctic Silver 5 or OCZ Freeze Thermal Interface material)

    material can be purchased at any store for PC. You can also have the fan replaced in a PC shop little charges.

    The original p/n is 5188-5525 to the heat sink. Source reference: HP PartSurfer

  • search for the name of view that can be added to the responsibility

    Hi Experts,

    How to find the name of view that can be added to that have been attributed to see the views of Catalog under quotes and orders.

    Help, please.

    Thank you and best wishes in advance

    Hello

    I guess that you do not specifically a particular display. If you want to find all the views in the Catalog under the orders & quotes you can follow the steps below:

    In the tab tools-flat - Select - display Template Web items:

    a. catalog views under citations: name that quotecatalog query * and GParentView in the catalog.

    You will be able to find the points of view. I am not correct on all points of view related to quotes. Choose from the list.

    b. catalog views under orders: name as orderEnrty query * and GParentView in the catalog.

    You will be able to find the points of view. I am not correct on all points of view related to quotes. Choose from the list.

    Try this and let me know.

    Kind regards
    Joseph

  • Google suggests another site when I try searching for the name of my Web site

    Hello!

    When I type my Web W-o-n-d-e-r-s-o-n-d site name in Google (no-), I get a suggestion to search for WondersoUnd instead...

    Type the first name and last name with www. and .com works, but this is not how users will search for my website.

    I also submitted my site to Google, but I don't see that he was really indexed. How long it usually takes and he will fix it?

    I already have things SEO who suggested in the official Adobe Muse tutorials.

    It is entirely up to Google. Your choice of a web site / domain name was simply not particularly intelligent, if she really all these hyphens. URL patterns is often areas of spam and it does not help ratings. That and of course who would think even of these obscure typing? I'm afraid that you have other issues than just trying to force Google...

    Mylenium

  • # used in the name column in DB

    I'm working with a pre-existing database in which many of the column names contain a sign #. Someone at - it a good solution for this scenario outside of rename column?

    Example of name of column: Last_CTR #.

    One option is to use an alias.



    SELECT [Last_CTR #] AS AliasForBadColumnName
    FROM SomeTable

  • How do I see the search for the other column table in a report

    Hello

    I created a 'form on the report' to get entry to reception.  Reception table has the column account_code.  How add place holder account_name column whose value can be fetch from table account_master.

    It is an interactive report on the form region.  I've learned there are two ways, one is to alert the request in the "source" of the report and include account_name column by joining the table account_master.  Another way is to create a calculation field? (not sure).

    I need to know what is the best way to achieve this.  I use APEX 4.2.6. EPG.

    Thank you

    -Anand

    Hi Anad,

    To configure a new column, you must run the page

    In the interactive report drop-> select the columns-> relating to the structure and then save it as the primary default report

    Thank you

    Sunil bhatia

  • Search for the specific column field in the entire database

    Dear all experts,

    I have a request, but I do not develop in fornt hand a POdate of values there, but I do not know what table it is stored. So I need a query that finds the column in question (POdate) of all the Tables.

    Is it possible if possible then kind view query.

    Kind regards
    Colette

    Hello

    Use this query
    SELECT TABLE_NAME FROM ALL_TAB_COLUMNS WHERE COLUMN_NAME = 'PODATE.

    Geeta-

  • Problem in the search using the Date column

    Hello

    I use the date in the search for field (jj-LUN-AA date selector) P1_END_DATE.

    When I search the record he won't give the result.
    I used the following in the where condition

    trunc (e.END_DATE) = trunc (to_date (:P1_END_DATE))

    Please notify.

    Concerning
    Harinder

    Harinder salvation,

    Make sure that you use the same date format as your date picker.
    Do not assume that they will be the same.
    TO_DATE (: PXX_XXX, ' dd/mm/yyyy');

    Concerning

    Michael

  • Specific occurrence of search in the number column

    Here's my data in the table: (Oracle 11.2.0.1 and Windows)

    Customer_No
    44444
    2561478
    5122
    1244421
    2454410
    1444444
    40444
    12344125
    1244044
    1244
    12304412444

    Power required:

    2454410
    12344125
    1244

    Only rows that have "44" in their customer_no. and it's also only once i.e.
    No '4' either just before the "44" or "4" right after "44" and which should only be once.

    This actually happens some time, when we get the Bill to the customer by post and when this Bill was damaged during transport. If we just want to see these lines whose "44" suppose that in this case is visible from the table due bills; in this case only "44" is visible, in other cases, some other numbers like "4444" If we want to get only the lines that have fixed matching patter.

    I think that this can be achieved by using REGULAR expression functions, but I read the documentation that much time to understand the REGEXP, but failed to understand and trusting it.

    Thank you.

    Published by: user12050217 on October 19, 2012 07:15

    And combine the two types of research design:

      WHERE regexp_count(customer_no,pattern) = 1
        AND (
                NOT regexp_like(pattern,'^' || substr(pattern,1,1) || '+$')
             OR
                regexp_count(customer_no,pattern || substr(pattern,1,1)) = 0
            )
    

    SY.

  • Querying the oracle table that has a column with the name of "FILE".

    Hi all

    I need to have an oracle table that has the column with the name "FILE".

    I can query all columns with the query "select * from table".

    But I'm not able to use the query "select the table file.

    This table is converted from ms access to oracle and I need to have this column with the name "FILE".

    Any suggestions?

    Thank you

    Abdellaoui

    Hello

    FILE is a keyword from Oracle, so it's not a good name,

    Use FILEDATE, or DATE_FILED, or something else that is not in V$ RESERVED_WORDS. KEYWORD as the name column.

    If you need to use the FILE, then you must use quotation marks.

  • Find the name of the column in all tables

    How to find the name of the column in all tables in the database for any column to reveal the name of the person?


    We have over 1000 tables looking for.and in some places, the name column FNAME LNAME, First_NAME, DNAME

    For example we have Customer table, Table EMPLOYEE and the ORDER Table

    --------------------------------

    Customer table
    --------------------------------

    LNMAE

    EMPLOYEE table

    EMP_ID
    DEPT_NAME (we don't want this column as it is not a name column)
    Last_name (he must propose this column because it is named)

    ----------------------------

    CONTROL Panel

    -----------------------------

    ORDER_ID
    ORDER_NAME (we don't want this column as it is not a name column)
    Last_name (he must propose this column because it is named)

    -------------------------

    Dept table

    -------------------------

    Dept_ID
    DEPT_NAME (we don't want this column as it is not a name column)

    Please advise...

    Thank you.

    Hello

    What exactly do you do?

    If you want to display the tables containing these columns, you can query the view data dictionary USER_TAB_COLS (or ALL_TAB_COLS, or, if you have privileges, DBA_TAB_COLS).

    For example:

    SELECT table_name, column_name

    Of user_tab_cols

    WHERE nom_de_colonne IN ('DNAME', 'FNAME', 'FIRST_NAME', 'LAST_NAME', 'LNAME') - or else

    ORDER BY table_name, column_name

    ;

  • Why the location column is empty for all messages?

    The location column header appears. but it has no content.

    According to me, the location column is empty because it is not relevant when you view the Threads (message list) of a right folder pane - the location is highlighted in the folders pane. But if you select a message that for example is part of a thread, with items in the files box of received and sent, then Message/Open in the Conversation, the location column displays the name of the folder for each message. Similarly, if you search for edit/search/search messages, the location column displays the folder where the search result is stored.

Maybe you are looking for

  • Firefox installer detected as Trojan Dropper.Generic8.BMWS by AVG when moving folder

    I was cleaning up my office moving my unused files to organized folders, for example, OriginalGameName, slipped into the games. and I happened to have an antivirus AVG scan running in the background at the same time. I created a folder named installe

  • Why should you do this?

    Why and how often should it be done? Mac OS 10.10.5

  • I use Director of windows, I downloaded some .avi files

    I use Director of windows, I downloaded some .avi files to make a video, I imported using import video, TI any nut when I went to drag the time line he put it under audio instead of video.

  • Pavilion p6110f disconnect

    I have a Pavillion p6110f and someone pulled apart connections... How the hell can I put this back together? I can't seem to find a diagram for the connections and I think may have it understood except for the one that makes the phone line works. Hel

  • How to call the function of backbean with javascript

    Good afternoonI have three in three minutes update my table of notifications.What I have so far is my refreshNotifications to the backingbean function and wanted to call a the same javascript function.know - tell me how?