Index rules in oracle text and query using matches

Dear All,
I would like to ask about rules and matches function in oracle text.
I followed an example in oracle text application developer's guide.
I have a rule table like this :
1 oracle
2 larry or ellison
3 oracle and text
4 market share
then, I create an index to that table. This is needed for calling matches function. Here is the syntax :
create index queryx on queries(query_string)
indextype is ctxsys.ctxrule;
then, I noticed that the result on DR$QUERYX$I table as follows :
LARRY 0 2 2 1 (BLOB)
MARKET 0 4 4 1 (BLOB) {MARKET} {SHARE}
ORACLE 0 1 1 1 (BLOB)
ORACLE 0 3 3 1 (BLOB) {TEXT}
ELLISON 0 2 2 1 (BLOB)
What I want to ask is why doesn't the words 'share' and 'text' appear in the DR$QUERYX$ table?
When we use matches function, it then search on the index result and consequently it wion't find the 'share' word. so when for example I do query like this :
select query_id from queries where matches(query_string,' It only share ten percent of all products sold')>0
it will give 0 result since the no word in ' It only share ten percent of all products sold' was in index table. But actually it could possibly be categorized as the 4 category which rules is 'market share'
I tried this in a larger set of data and get same result.
Here is my generated rules from my document collection :
1 {REQUIREMENTS} & {ELICITATION}
1 {REQUIREMENTS} ~ {ELICITATION} & {ACTOR}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} & {FURPS}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} & {PROC}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} & {SPEED}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} & {DOCUME}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} ~ {DOCUME} & {PLACED}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} ~ {DOCUME} ~ {PLACED} & {UNNECESSARY}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} ~ {DOCUME} ~ {PLACED} ~ {UNNECESSARY} & {MISUSE}
1 {INTERPRETATION} ~ {REQUIREMENTS}
2 {DESIGN} & {REPRESENTATION}
2 {DESIGN} ~ {REPRESENTATION} & {MAY} & {FOUNDATI} & {OCTOBER}
2 {DESIGN} ~ {REPRESENTATION} & {MAY} & {FOUNDATI} ~ {OCTOBER} & {PROCEDURAL}
2 {DESIGN} ~ {REPRESENTATION} & {MAY} & {FOUNDATI} ~ {OCTOBER} ~ {PROCEDURAL} & {STRICT}
2 {DESIGN} ~ {REPRESENTATION} & {MAY} & {FOUNDATI} ~ {OCTOBER} ~ {PROCEDURAL} ~ {STRICT} & {GRASP}
2 {DESIGN} ~ {REPRESENTATION} & {MAY} & {FOUNDATI} ~ {OCTOBER} ~ {PROCEDURAL} ~ {STRICT} ~ {GRASP} & {MANY} & {LAYER}
2 {DESIGN} ~ {REPRESENTATION} ~ {MAY}
3 {PM} & {TESTING} & {ATTRIBUTI}
And this is the index table result with ctxrule :
(only the token_text column shown)
PM
DESIGN
DESIGN
DESIGN
DESIGN
DESIGN
DESIGN
DESIGN
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
INTERPRETATION
so when I try to classify a document with the word ouline inside it, it should produce category 1 (based on the rules) but since there are no word 'outline' in index tabel, the matches will return 0 means that the document is not classifiedto any category. I don't understand why it happen. Anybody knows about this? I would really appreciate any help.
Thank you very much.

Hm, I see. It do make sense. so nice to know.
But then in the second example I gift where I used larger table, as shown below :
Here is my generated rules from my document collection :
1 {REQUIREMENTS} & {ELICITATION}
1 {REQUIREMENTS} ~ {ELICITATION} & {ACTOR}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} & {FURPS}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} & {PROC}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} & {SPEED}
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} & {DOCUME}
1 {INTERPRETATION} ~ {REQUIREMENTS}
2 {DESIGN} & {REPRESENTATION}
2 {DESIGN} ~ {REPRESENTATION} & {MAY} & {FOUNDATI} & {OCTOBER}
2 {DESIGN} ~ {REPRESENTATION} & {MAY} & {FOUNDATI} ~ {OCTOBER} & {PROCEDURAL}
2 {DESIGN} ~ {REPRESENTATION} & {MAY} & {FOUNDATI} ~ {OCTOBER} ~ {PROCEDURAL} & {STRICT}
2 {DESIGN} ~ {REPRESENTATION} ~ {MAY}
3 {PM} & {TESTING} & {ATTRIBUTI}
As far as I know, the sign ' ~ ' means 'OR' and '&' means 'and' . So based on the 4th line in my table :
1 {REQUIREMENTS} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE}
it can be concluded that if any of the words stated there been queried, so the category '1' will appear as a result. But then before we can use 'matches' to query it, we need ti create index for the rules table . I did it and the result were :
(only the token_text column shown)
PM
DESIGN
DESIGN
DESIGN
DESIGN
DESIGN
DESIGN
DESIGN
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
REQUIREMENTS
INTERPRETATION
there were no words other than PM, DESIGN< REQUIREMENTS and INTERPRETATION. Why the words REQUIREMENTS, ELICITATION, ACTOR, FURPS, OUTLINE don't appear in the index result?

Similar Messages

  • Oracle Text contain query limit with 9i

    The Oracle Text contain query is defined as this:
    CONTAINS(
    [schema.]column,
    text_query VARCHAR2
    [,label NUMBER])
    RETURN NUMBER;
    Is the size limit of text_query 4000 bytes with 9i? Is it increased with 10g or is it accepting CLOB in 10g?
    I always got the error: "ORA-01460: unimplemented or unreasonable conversion requested" when I do the following where p_var was dynamically passed with size of more than 4000 bytes:
    p_statement varchar2(20000);
    p_var varchar2(8000);
    p_statement := select count(*) from dewey_table where contains(concat, :x)>0;
    open m_cursor for p_statement using p_var;
    Thanks very much,
    Kevin

    The limit is definitely 4000 characters in 9i and the 10g documentation shows no change in the calling spec for that parameter.

  • Oracle Text and Custom item type

    I have a custom item type defined that has custom attributes. With Oracle Text disabled, I can use a custom search to find these items either by their standard attributes (name,description, etc.) or their custom attributes. However, as soon as I enable Oracle Text (and allow the indexing process to complete), I can no longer locate these items in a search.
    I assume that I need to do something to tell Oracle Text to index these types of items, but could not find anything in documentation. Any assistance would be appreciated.
    Also, assuming we get around the above issue, if I have Oracle Text enabled, does this mean I will not be able to find these items after they are created until the next scheduled index update? Is there away around this besides killing Oracle Text?
    Rgds/Mark M.
    Portal 9.0.2.6

    The indexes need to be synchronised for the items to be searched and returned. Hence until the next scheduled index update, the item will not be returned. To explicitly udpate the indexes, run the procedure in the portal database connected as the schema owner.
    SQL> exec wwv_context.sync();

  • Oracle Text and TREC

    Hello,
    I am new to SQL, Oracle, and Oracle Text and need to use Oracle Text to index about 2GB of files (located on the filesystem), each of which contain multiple documents. These documents are all in SGML format with the relevant data I need being inbetween DOCNO and TEXT tags.
    So far I understand I need to create a table similar to the following...
    create table "DocTable" ("Docno" number, "Text" text)
    ...and then either use a CONTEXT or CTXCAT index, but im not sure which.
    In general im not too sure what to do. Any help is appreciated.
    Thanks :)

    it actually depends upon what u r searching for
    A file datastore is works as below
    1) a location where all your files are stored - say /mydocs
    so you need to create a preference
    begin
    ctx_ddl.create_preference('COMMON_DIR','FILE_DATASTORE');
    ctx_ddl.set_attribute('COMMON_DIR','PATH','/mydocs');
    end;
    now create a table where you list down all the file names, the doc id is something for your reference. This can be any number which you prefer. But has to be unique, as this a pkey.
    create table mytable(id number primary key, docs varchar2(2000));
    insert into mytable values(111555,'first.txt');
    insert into mytable values(111556,'second.txt');
    commit;
    Now indexing, which ctaully fetches the documents from the file location
    create index myindex on mytable(docs)
    indextype is ctxsys.context
    parameters ('datastore COMMON_DIR');
    now the queries on the table will be using CONTAINS operator - as you have created a CONTEXT index.
    So , you need to fist determine what kind of queries you need to make. On the basis of that you can create the index.

  • Oracle Text and Workspace Manager

    Has anybody incoroporated Workspace Manager and Oracle text together. How is the Oracle Text index handled? Can users in different workspaces submit documents, have them indexed and be the only ones to see those documents?

    Hi,
    I do not have much experience with Oracle text, and am unsure exactly how it works. As such, I would suggest to file a TAR requesting this information.
    Regards,
    Ben

  • Calling Oracle function and Procedure using OCCI with in C++ code

    Could any body send me the sample code to create and execute Oracle function and Procedure using OCCI concept in C++?.
    Edited by: 788634 on Aug 16, 2010 4:09 AM

    Hi Vishnu,
    Yes, sure, you can create a PL/SQL procedure, function, package, package body, etc. from within an OCCI application. I would say that, generally, this is not the sort of activity a typical client application would perform unless there is some initialization/installation processes that need to happen. In any case, here is a simple demo showing how to create a stand alone procedure (in a real application I would use a package and body) that returns a ref cursor. The ref cursor is just a simple select of two columns in the hr.countries sample table. Of course, there is no error handling, object orientation, etc. in this demo - I wanted to keep the code as short and as simple as possible to illustrate the concept.
    Regards,
    Mark
    #include <occi.h>
    #include <iostream>
    using namespace std;
    using namespace oracle::occi;
    int main(void)
      // occi variables
      Environment *env;
      Connection  *con;
      Statement   *stmt;
      ResultSet   *rs;
      // database connection information
      string user = "hr";
      string passwd = "hr";
      string db = "orademo";
      // sql to create the procedure which returns a ref cursor as out parameter
      // should be run as hr sample user or in a schema that has select privilege
      // on the hr.countries table and a synonym (countries) that points to the
      // hr.countries table
      string sqlCreate =
        "create or replace procedure get_countries(p_rc out sys_refcursor) as "
        "begin"
        " open p_rc for"
        " select country_id, country_name from countries order by country_name; "
        "end;";
      // pl/sql anonymous block to call the procedure
      string sqlCall = "begin get_countries(:1); end;";
      // create a default environment for this demo
      env = Environment::createEnvironment(Environment::DEFAULT);
      cout << endl;
      // open the connection to the database
      con = env->createConnection(user, passwd, db);
      // display database version
      cout << con->getServerVersion() << endl << endl;
      // create statement object for creating procedure
      stmt = con->createStatement(sqlCreate);
      // create the procedure
      stmt->executeUpdate();
      // terminate the statement object
      con->terminateStatement(stmt);
      // now create new statement object to call procedure
      stmt = con->createStatement(sqlCall);
      // need to register the ref cursor output parameter
      stmt->registerOutParam(1, OCCICURSOR);
      // call the procedure through the anonymous block
      stmt->executeUpdate();
      // get the ref cursor as an occi resultset
      rs = stmt->getCursor(1);
      // loop through the result set
      // and write the values to the console
      while (rs->next())
        cout << rs->getString(1) << ": " << rs->getString(2) << endl;
      // close the result set after looping
      stmt->closeResultSet(rs);
      // terminate the statement object
      con->terminateStatement(stmt);
      // terminate the connection to the database
      env->terminateConnection(con);
      // terminate the environment
      Environment::terminateEnvironment(env);
      // use this as a prompt to keep the console window from
      // closing when run interactively from the IDE
      cout << endl << "ENTER to continue...";
      cin.get();
      return 0;
    }

  • Is it possible to extract the text and images using PHP

    Hi friends,
    Is it possible to extract the text and images using PHP, in the same order as it is in the PDF?
    Else is it possible extract the same as XML using PHP, or ASP
    I googled it but its in vain, any help is appreciated.
    Thanks in advance.

    Dear Mike,
    Thanks for your quick reply,
    I mean is it possible to parse the PDF line by line using the PHP.
    I extracted the whole text but couldn't the images. Since the PDF's images are decoded using various methods like DCTDecode, JPXDecode, etc.
    The text is decoded with FlateDecode, which i breaked using a function in PHP.
    Thanks,

  • Manual Install of Oracle Text and XDB for 11g

    I can't find the Metalink manual install docs for Oracle Text and XDB. For unknown reasons the DB was created with out them. I see the docs for 9i and 10g, but not 11g.
    Thanks!

    Hi,
    I think you are in APEX forum.
    This question seems more suitable for installation forum: Database Installation
    Also, please see if this thread helps: How do I install ORACLE TEXT
    Ta,
    Trent

  • Does oracle 8i and beyond use ORA_ENCRYPT_LOGIN?

    Does sqlldr and sqlplus for Oracle 8i and later use
    the ORA_ENCRYPT_LOGIN Environment variable anymore?

    i believe the ORA_ENCRYPT_LOGIN is still valid in 8i + but only has an effect when we are connecting to much earlier versions of the database. Net8 always encrypts passwords, so setting this parameter has no effect when connecting to an 8i database.
    Cheers, APC

  • Load Text and Attribute using same DataSource

    Hi,
    Is it possible to load text and attributes using same datasource? If yes than how can this be done?
    Thank you,
    CD

    Yes you are right in that case it will be an attribute , and in the report show it as display attribute. If you want to apply the text at Infoobject level,
    (1) In the change mode of Iinfoobject , check both with Master data and Text boxes , in the Master data /text tab
    (2) Make Flexible or direct update
    (3) Create 2 Infopackages one loading from ATTR data source and the other from TEXT data source respectively.
    hope it helps,

  • I need to know how to edit a drawing - basically remove the arrows and text but at the same time match the background of the existing pic. then re add new text. how do i erase the arrows and text and arrows but match current background of pic. step by ste

    i need to know how to edit a drawing - basically remove the arrows and text but at the same time match the background of the existing pic. then re add new text. how do i erase the arrows and text and arrows but match current background of pic. step by step explanation please beginner

    Please post (a relevant section of) it right on this Forum.

  • Oracle TEXT and using 'ABOUT' as a string literal, not a command

    We have a context index on a NAME column, and we're getting an error when searching on the string
    CONTAINS(name, '%ALL ABOUT TRAVEL%') > 0A query on ALL ABOUT, and ABOUT TRAVEL works, but the entire phrase causes a problem. I've since found that ABOUT is a keyword when using CONTAINS( ).
    So, is there a way to escape ABOUT, include it in double quotes, etc, so that it gets treated as a string literal?
    Thanks,
    --=Chuck

    Should've searched google more before posting ... :(
    Maybe this'll help someone else out, though:
    CONTAINS(name, '%ALL {ABOUT} TRAVEL%') > 0

  • Oracle Text and APEX

    Hello
    Tried the Oracle White Paper - Oracle Text Web Applications
    Created the table and populated with relevant url links
    create table htmldb_documentation(
    id number,
    doc_title varchar2(4000),
    doc_url varchar2(4000))
    then created the index
    create index htmldb_doc_ctxidx on htmldb_documentation(doc_url)
    indextype is ctxsys.context
    parameters ('datastore CTXSYS.URL_DATASTORE')
    Then ran my SQL for the report in Toad and APEX SQL Workshop>SQL Commands before creating an APEX Region based on a SQL Report
    select score(1) relevance, doc_title, doc_url
    from htmldb_documentation
    where CONTAINS (doc_url, :P1_SEARCH, 1) > 0
    order by 1 desc
    After running the APEX Report I get error
    report error:
    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-20000: Oracle Text error:
    DRG-50901: text query parser syntax error on line 1, column 1
    I also ran these grant commands after I received this error
    grant ctxapp to demo;
    grant execute on ctx_cls to demo;
    grant execute on ctx_ddl to demo;
    grant execute on ctx_doc to demo;
    grant execute on ctx_output to demo;
    grant execute on ctx_query to demo;
    grant execute on ctx_report to demo;
    grant execute on ctx_thes to demo;
    grant execute on ctx_ulexer to demo;
    Any ideas ?? I'm running APEX 3.1.0.00.32 on Oracle 10.2.0.1 on WindowsXP
    If I replace the bind variable :P1_SEARCH, with a literal value the error disappears

    Couple of things to check:
    1) do you have an item called P1_SEARCH in your application?
    2) If so, make sure that it has a value; otherwise, Oracle Text gets confused and will throw that error.
    You may want to consider using a PL/SQL Function Returning SQL Query that will only append the CONTAINS clause if P1_SEARCH has some value.
    Thanks,
    - Scott -
    http://sumnertechnologies.com
    http://spendolini.blogspot.com

  • Oracle Text and MINUS character

    Hi all,
    I have following problem:
    - I have created a Oracle Text Index on the VARCHAR2 column:
    BEGIN
      ctx_ddl.create_preference('SUBSTRING_PREF','BASIC_WORDLIST');
      ctx_ddl.set_attribute('SUBSTRING_PREF','SUBSTRING_INDEX','TRUE');
    END;
    CREATE INDEX IDX_TEXT_1 ON MY_TABLE
    (COLUMN1)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS('wordlist SUBSTRING_PREF memory 50m')
    NOPARALLEL;- I execute the following SELECT:
    SELECT mt.*
    FROM  MY_TABLE mt
    WHERE  contains(mt.COLUMN1, 'test%') > 0;It returns all records where the column1 contains the entry "test" + something else.
    BUT the records where column1 contains the entries "my-test" + something else or "owr-test" + something else, a.s.o.
    It should return only the records with "test" + something else entries.
    How can I change the Index or query to achieve it?
    Best regards

    By default, the hyphen is treated as a break character and the words on either side are indexed as separate tokens. To change this behavior, you can create a lexer, set the printjoins attribute of the lexer to include the hyphen, then use that lexer in your index parameters. Then, strings of characters containing a hyphen will be indexed as one token, including the hyphen. Please see the example below.
    SCOTT@orcl_11gR2> CREATE TABLE my_table (column1  VARCHAR2(60))
      2  /
    Table created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO my_table VALUES ('test')
      3  INTO my_table VALUES ('testing')
      4  INTO my_table VALUES ('my-test')
      5  INTO my_table VALUES ('owr-test')
      6  SELECT * FROM DUAL
      7  /
    4 rows created.
    SCOTT@orcl_11gR2> BEGIN
      2    ctx_ddl.create_preference('SUBSTRING_PREF','BASIC_WORDLIST');
      3    ctx_ddl.set_attribute('SUBSTRING_PREF','SUBSTRING_INDEX','TRUE');
      4    CTX_DDL.CREATE_PREFERENCE ('test_lex', 'BASIC_LEXER');
      5    CTX_DDL.SET_ATTRIBUTE ('test_lex', 'PRINTJOINS', '-');
      6  END;
      7  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> CREATE INDEX IDX_TEXT_1 ON MY_TABLE (COLUMN1)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  PARAMETERS
      4    ('wordlist  SUBSTRING_PREF
      5        LEXER        test_lex
      6        memory    50m')
      7  NOPARALLEL
      8  /
    Index created.
    SCOTT@orcl_11gR2> SELECT token_text FROM dr$idx_text_1$i
      2  /
    TOKEN_TEXT
    MY-TEST
    OWR-TEST
    TEST
    TESTING
    4 rows selected.
    SCOTT@orcl_11gR2> SELECT mt.*
      2  FROM   MY_TABLE mt
      3  WHERE  contains (mt.COLUMN1, 'test%') > 0
      4  /
    COLUMN1
    test
    testing
    2 rows selected.

  • Oracle Text and table joins

    Is it possible to create an index on a view as opposed to a table, when using Oracle Text?

    Thanks for the earlier response.
    I was also loooking at Oracle Ultra Search. I figured out that Ultr search provides out of the box query application to do free-form text search, parameterized search and so on....
    I also read that Oracle Ultra search uses Oracle text as the underlying technology to do the search.
    I have a requirement where most of my searches will be on structured data spread across multiple tables. But I also have a requirement to index some static content which resides on the file system.
    Is it possible to mix and match query results i.e. first perform a search on the structured data and then perform another search on the static document data and then megre results from both and display back to the user?
    Thanks for the help

Maybe you are looking for

  • Performance issue - Select statement

    Hi  I am having the 10 lack records in the KONP table . If i am trying to see all the records in SE11 , it is giving the short dump TSV_TNEW_PAGE_ALLOC_FAILED . I know this is because of less memory in the Server . Is there any other way to get the d

  • Trying to connect to Oracle using Web App

    Hi Guys, I'm hoping someone here can help. This question goes out to anyone who has tried to connect to an Oracle database via web application written using Java Server Pages and Servlets. There is a specific file called the context.xml that contains

  • "Currently unable to add funds to your account. Please try again later."

    ultimatedeterus wrote: I tried to add funds to my PSN account with my debit card. but seems like it did not work.it showed "Currently unable to add funds to your account. Please try again later."and also i found there's $1 pending transaction on my b

  • Vendor bank to company code

    Dear Forum, I check LFA1, LFBK, LFB1 to get the link of vendor bank to company code but could not get. LFA1 no bank information whereas LFBK no company code. Why there is no link? I need vendor bank which link to company code. I have same vendor in t

  • How can i do  a query?

    hello, i've insert my xml documents in my table , and now i want to do queries to see if the data is correct or no, how can i do it? i will put a small example of my xml document, and i want to have a query example for this docuemts. thanks: <?xml ve