Oracle Context Index on multicolumns
-
I have an oracle database (8.1.7) ... it has two columns that i want to context index title and subtitle I want to run a query like this when i'm finished select isbn,title,subtitle from MASTER where contains (concat, 'Cheeses',1) > 0 and get results. (the above query returns 0 records) Here's what i've tried so far to create the DATASTORE http://www.completebook.com/newcontext.txt This does not work... It makes me do this select isbn,title,subtitle from MASTER where contains (concat, 'Cheese within {the_title}',1) > 0; (the above record returns 500 records) But i want both title and subtitle... FYI, Select COUNT(*) from MASTER where title like '%cheese%' returns 500 select count(*) from MASTER where subtitle like '%cheese%' returns 13. Any oracle masters out there willing to take this on? Brian Gannon
-
Answer:
Hi Brian, From your question, there appears to be multiple ways to solve your problem. Essentially what you need to do is consider both the title and the subtitle columns together in order to obtain the desired result. METHOD #1: OR Condition --Begin Query SELECT isbn,title,subtitle FROM MASTER WHERE title like '%cheese%' OR subtitle like '%cheese%' --End Query This query will include rows that have the string cheese somewhere within the title and/or subtitle. In other words, only a single conditino needs to be met for the row to be included in the result. METHOD #2: UNION Condition --Begin Query SELECT isbn, title, subtitle FROM MASTER WHERE title like '%cheese%' UNION SELECT isbn, title, subtitle FROM MASTER WHERE subtitle like '%cheese%' --End Query This method is slightly different as far as the actual operation being conducted. There are actually two queries being executed here where each one considers one condition. The 'UNION' operator will take these two resulting tables and combine them into a single result. For rows that contain 'cheese' in both the title and subtitle, the duplicate will be removed. If you want to keep the duplicate, simply replace 'UNION' with 'UNION ALL'. Either of the above queries should do what you require, but feel free to post a clarification if any of the above information is unclear :) Cheers! answerguru-ga Google Answers Researcher
chiefarcher-ga at Google Answers Visit the source
Related Q & A:
- Is Guillou-Quisquater existentially unforgeable against adaptive message attack under a random oracle model?Best solution by Cryptography
- How to do context-free grammar?Best solution by Stack Overflow
- How to change the font size of context menu?Best solution by Super User
- What is design in architecture context?Best solution by Stack Overflow
- What were the challenges ahead for the Insurance industry in the context of the global credit crisis?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.