Text searching [message #189181] |
Wed, 23 August 2006 09:31 |
SaraC
Messages: 81 Registered: August 2005
|
Member |
|
|
Hi
I want to search a concatenation of columns for string tokens - trying to implement a free text search feature.
Is there any other way than to use WHERE concat_string LIKE '%AB%' etc could be that I have any number of tokens to search the string for and not (necessarily in the order they appear in the concatenated string (if they appear)
Will keep looking myself and check back to see if anyone has answered. Working with 9i.
Thanks
[Updated on: Wed, 23 August 2006 09:59] Report message to a moderator
|
|
|
|
Re: Text searching [message #189349 is a reply to message #189181] |
Thu, 24 August 2006 04:26 |
SaraC
Messages: 81 Registered: August 2005
|
Member |
|
|
Thanks frank that looks useful. Have you used it. Does it only support searching for whole words not partial strings
i.e. like '%hi% would match high but using oracle Text searching doesnt seem to...
Actually I got CONTAINS to return using wildcard but not CATSEARCH.
however read that contains needs the index to be synchronised after each DML statement and as there could be numerous updates to my table at any time the catsearch might be better since it doesnt need the synchronising but doesnt offer the wildcard.
Maybe it is better to just use LIkE %% for my case as I think its relatively small compared to how these features are supposed to be used i.e search from documents etc rather than just table values.
S
[Updated on: Thu, 24 August 2006 05:38] Report message to a moderator
|
|
|
|
Re: Text searching [message #189366 is a reply to message #189358] |
Thu, 24 August 2006 04:56 |
Frank Naude
Messages: 4589 Registered: April 1998
|
Senior Member |
|
|
Try this:
SELECT SCORE(1), title
FROM my_text_table
WHERE CONTAINS(textcol, '%hi%', 1) > 0;
Example:
SQL> CREATE TABLE my_text_table(
2 id NUMBER PRIMARY KEY,
3 title VARCHAR2(30),
4 doc CLOB
5 );
Table created.
SQL>
SQL> INSERT INTO my_text_table VALUES(1, 'doc1', 'Hi Sara, ...');
1 row created.
SQL> INSERT INTO my_text_table VALUES(2, 'doc2', 'Hi Hi Mam');
1 row created.
SQL> INSERT INTO my_text_table VALUES(3, 'doc3', 'A highly recommended document');
1 row created.
SQL> INSERT INTO my_text_table VALUES(4, 'doc4', 'Another document');
1 row created.
SQL>
SQL> CREATE INDEX my_text_index ON my_text_table(doc)
2 INDEXTYPE IS ctxsys.context;
Index created.
SQL>
SQL> SELECT SCORE(1), title
2 FROM my_text_table
3 WHERE CONTAINS(doc, '%hi%', 1) > 0;
SCORE(1) TITLE
---------- ------------------------------
4 doc1
8 doc2
4 doc3
|
|
|
|
|
|
Re: Text searching [message #436997 is a reply to message #436962] |
Wed, 30 December 2009 04:39 |
|
Barbara Boehmer
Messages: 9104 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
ora22 wrote on Tue, 29 December 2009 21:46
if using ctxcat - is there a way to search on multiple coulumns with a WITHIN type functionality ?
No. CTXCAT is limited to one text column. You could create a concatenated column or a view that concatenates the columns and create your index on that, in order to be able to search multiple columns, but you would not be able to specify which colunn using WITHIN or any other method. You will need a CONTEXT index.
|
|
|