Hi everybody,
I am pretty new on Oracle Text so please be merciful :)
I am on Oracle 10.2.0.4.0 and I need to provide my users with ALL snippets found in a text, but it seems that CTX_DOC.SNIPPET restricts the number of snippets occurrences (I will exemplify it later).
The question is: is there a way to increase the number of results/snippets returned by CTX_DOC.SNIPPET ?
In the example that follows, I create the table "mysearch" and an index of type CTXSYS.CONTEXT, then I run the final SELECT query with CTX_DOC.SNIPPET() to obtain a list of most relevant fragments.
If you run the query - see the column "SNIPPET" - record #6 is returning only the first 4 occurrences. In this case (especially because is a single row) I would expect to find all 6 occurrences instead of 4.
Again, if looking to record #7 I have only 3 occurrences.
Then for record #8 I have only 2 occurrences.
I know that CTX_DOC.SNIPPET retrieves the "most" relevant fragment, but I would like to obtain the full list of fragments present in the indexed text. Is there a way (or an alternate method) to accomplish what I like to do.
I have also noted that CTX_DOC.MARKUP can be used on the
same index to retrieve the full text "marked-up" with my query terms, so I know Oracle has indexed the text somewhere, I need only to get it out !
Any help will be very appreciated.
Thanks,
Luigi
DROP TABLE mysearch;
/
create table mysearch (text_id number primary key, text clob);
/
insert into mysearch values (1, 'this is a test record which contains no more than one occurrence of the word you search');
insert into mysearch values (2, 'this is a second test record which contains two occurrences of the word test');
insert into mysearch values (3, 'this is a third test record which contains three test occurrences of the word test');
insert into mysearch values (4, 'this test is a fourth test record which contains four test occurrences of the word test');
insert into mysearch values (5, 'this test is the fifth test record which contains five test occurrences of the word test for test purposes');
insert into mysearch values (6, 'this sixth test is a test with more than 200 character which contains many test occurrences of test word, sixth test record which contains sixth test occurrences of the word test for test purposes');
insert into mysearch values (7,
'Oracle Text adds powerful test search withintitle and intelligent test management to the Oracle database. Complete. You can test search and manage documents, web pages, catalog entries in more than test 150 formats in any language. Provides a complete text query language and complete character support. Simple. You can index and search test text using SQL. Oracle Test Management can be done using Oracle Test Manager - a GUI tool. Fast. You can search
millions of documents, Test,web pages, catalog entries using the power and Test of the database. Intelligent. Oracle Text''s unique knowledge-base enables you to search, classify, manage documents, clusters Test summarize text based on its meaning as well as its content.');
insert into mysearch values (8,'Written by the worlds most widely-read test authors of best-selling Oracle books, Mike Ault, Daniel Liu and Madhu Tumma target their substantial knowledge of test evaluating Oracle new features in this important book. test With decades of experience evaluating new Oracle features, this book focuses on the most important test new DBA features of Oracle 10g as they relate to database administration and Oracle tuning.
This book provides honest feedback about those Oracle test 10g features that you should use, test and those you should not use. The text takes an in-depth look at test those Oracle10g features that are the most important to system performance and Oracle10g database administration.
Best of all, the authors have created dozens of working test samples in the Oracle10g online code depot. Examples from all areas of Oracle10g are covered with working scripts and code snippets. Your time savings from a single script is test worth the price of this great book.
Daniel Liu test is a senior Oracle Database test Administrator at First American Real Estate Solutions in Anaheim, CA. He has many years of industry test experience in database administration and software development. He has worked with large-scale databases in multi-platform environments. His test expertise includes Oracle database administration, performance tuning, Oracle networking, and Oracle test Application Server.
As an Oracle Certified Professional, he taught Oracle certified DBA classes at Elite Consulting Group in Chicago. Daniel also taught IOUG University Seminar in Orlando. Daniel has published articles with DBAzine, Oracle Internals, and SELECT Journal. Daniel has received SELECT Editorial Test Award for Best Article in 2001. He has also given presentations at IOUG-A Live, LAOUG, OCOUG, NoCOUG, Oracle Test Open World and Oracle World. Daniel has served as panelist on Oracles of Oracle at Oracle World and IOUG-Live. Daniel holds a Master of Science degree in computer science from Northern Illinois University.
Madhu Tumma has been working as Software test Developer, IT Manager, Database Administrator, and Technical Consultant for about 18 years. He has worked on a wide variety of projects and environments ranging from mainframe, client-server, Test eBusiness to managed services. He has provided consultancy to variety of clients on database clusters, business continuity and high availability solutions.
His experience ranges across multiple relational database systems. Madhu is frequent Test speaker at Oracle World and IOUG where he presented many technical papers. Madhu has Master Degree in test science and attended Business Management graduate program. He lives in New Jersey with his wife Hema and two children Sandi and Sudeep.');
/
CREATE INDEX mysearchindex ON mysearch (text)
INDEXTYPE IS CTXSYS.CONTEXT
/
CALL CTX_DOC.SET_KEY_TYPE ('PRIMARY_KEY');
/
SELECT text_id,
text,
ctx_doc.snippet('mysearchindex',TO_CHAR(text_id), 'test') AS SNIPPET
FROM mysearch
WHERE CONTAINS (text, 'test', 1) > 0
/