|
|
Re: Near operator with Ctxcat index (split from CTXCAT / CONTEXT index by bb) [message #351432 is a reply to message #351314] |
Tue, 30 September 2008 16:50 |
|
Barbara Boehmer
Messages: 9104 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
If you are using a ctxcat index, then you must use the catsearch operator to search it. The catsearch operator is very limited by itself and does not support NEAR. However, if you use a query template so that you can use the context grammar, then you can use NEAR. I have demonstrated this below. It might be beneficial if you only occasionally use NEAR. However, if you are going to use queries with NEAR or other things that catsearch does not support frequently, then you might as well just use a context idex.
SCOTT@orcl_11g> CREATE TABLE test_tab (test_col VARCHAR2(30))
2 /
Table created.
SCOTT@orcl_11g> INSERT INTO test_tab (test_col) VALUES ('cat mouse dog')
2 /
1 row created.
SCOTT@orcl_11g> CREATE INDEX test_idx ON test_tab (test_col)
2 INDEXTYPE IS CTXSYS.CTXCAT
3 /
Index created.
SCOTT@orcl_11g> SELECT * FROM test_tab
2 WHERE CATSEARCH (test_col, 'cat NEAR dog', NULL) > 0
3 /
no rows selected
SCOTT@orcl_11g> SELECT * FROM test_tab
2 WHERE CATSEARCH
3 (test_col,
4 '<query>
5 <textquery grammer="context">
6 cat NEAR dog
7 </textquery>
8 </query>', NULL) > 0
9 /
TEST_COL
------------------------------
cat mouse dog
SCOTT@orcl_11g>
|
|
|