Home » Server Options » Text & interMedia » oracle text contains near (Oracle 11g)
oracle text contains near [message #294099] |
Wed, 16 January 2008 07:59 |
amparo
Messages: 2 Registered: January 2008
|
Junior Member |
|
|
Near (with proximity) not work with stopword.
please, How I can do??????
Thank you.
---->count "web" but "web is include into stoplist
begin
ctx_ddl.create_stoplist('mystop');
end;
begin
ctx_ddl.add_stopword('mystop', 'el');
ctx_ddl.add_stopword('mystop', 'the');
ctx_ddl.add_stopword('mystop', 'web');
end;
CREATE TABLE PRUEBA_DOC
( ID NUMBER,
TITULO VARCHAR2(60 BYTE),
DOCUMENTO CLOB
)
CREATE INDEX PRUEBA_DOC_IDX ON PRUEBA_DOC (TITULO)
INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS('STOPLIST mystop')
SELECT *
FROM prueba_doc
where contains ( titulo, 'near((perro,vecina),4,TRUE)',1 ) >0
22 el perro de web vecina el gato
33 el perro en la de web vecina el gato
55 el perro de el the web vecina el gato
66 el perro que está en salón vecina el gato
SELECT *
FROM prueba_doc
where contains ( titulo, 'near((perro,vecina),3,TRUE)',1 ) >0
22 el perro de web vecina el gato
SELECT *
FROM prueba_doc
where contains ( titulo, 'near((perro,vecina),1,TRUE)',1 ) >0
0 rows.
|
|
|
|
Re: oracle text contains near [message #295228 is a reply to message #294099] |
Mon, 21 January 2008 16:54 |
|
Barbara Boehmer
Messages: 9104 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
Stopwords are still counted when using the near operator:
SCOTT@orcl_11g> CREATE TABLE PRUEBA_DOC (TITULO VARCHAR2(60 BYTE))
2 /
Table created.
SCOTT@orcl_11g> INSERT ALL
2 INTO prueba_doc VALUES ('perro vecina')
3 INTO prueba_doc VALUES ('perro stopword vecina')
4 INTO prueba_doc VALUES ('perro nonstopword vecina')
5 INTO prueba_doc VALUES ('perro stopword stopword vecina')
6 INTO prueba_doc VALUES ('perro nonstopword nonstopword vecina')
7 INTO prueba_doc VALUES ('perro stopword nonstopword vecina')
8 SELECT * FROM DUAL
9 /
6 rows created.
SCOTT@orcl_11g> EXEC CTX_DDL.CREATE_STOPLIST ('mystop')
PL/SQL procedure successfully completed.
SCOTT@orcl_11g> EXEC CTX_DDL.ADD_STOPWORD ('mystop', 'stopword')
PL/SQL procedure successfully completed.
SCOTT@orcl_11g> CREATE INDEX PRUEBA_DOC_IDX ON PRUEBA_DOC (TITULO)
2 INDEXTYPE IS CTXSYS.CONTEXT
3 PARAMETERS ('STOPLIST mystop')
4 /
Index created.
SCOTT@orcl_11g> SELECT spw_word FROM ctx_stopwords WHERE spw_stoplist = 'MYSTOP'
2 /
SPW_WORD
--------------------------------------------------------------------------------
stopword
SCOTT@orcl_11g> SELECT token_text FROM dr$prueba_doc_idx$i
2 /
TOKEN_TEXT
----------------------------------------------------------------
NONSTOPWORD
PERRO
VECINA
SCOTT@orcl_11g> -- up to 2 words inbetween:
SCOTT@orcl_11g> SELECT titulo FROM prueba_doc where contains ( titulo, 'near((perro,vecina),2,TRUE)',1 ) > 0
2 /
TITULO
------------------------------------------------------------
perro vecina
perro stopword vecina
perro nonstopword vecina
perro stopword stopword vecina
perro nonstopword nonstopword vecina
perro stopword nonstopword vecina
6 rows selected.
SCOTT@orcl_11g> -- up to 1 word inbetween:
SCOTT@orcl_11g> SELECT titulo FROM prueba_doc where contains ( titulo, 'near((perro,vecina),1,TRUE)',1 ) > 0
2 /
TITULO
------------------------------------------------------------
perro vecina
perro stopword vecina
perro nonstopword vecina
SCOTT@orcl_11g> -- no words inbetween:
SCOTT@orcl_11g> SELECT titulo FROM prueba_doc where contains ( titulo, 'near((perro,vecina),0,TRUE)',1 ) > 0
2 /
TITULO
------------------------------------------------------------
perro vecina
SCOTT@orcl_11g>
|
|
|
Re: oracle text contains near [message #295423 is a reply to message #294099] |
Tue, 22 January 2008 05:25 |
amparo
Messages: 2 Registered: January 2008
|
Junior Member |
|
|
"perro stopword stopword vecina", Oracle belives "near 2", but would "near 0".
SCOTT@orcl_11g> SELECT titulo FROM prueba_doc where contains ( titulo, 'near((perro,vecina),2,TRUE)',1 ) > 0
2 /
TITULO
------------------------------------------------------------
perro vecina
perro stopword vecina
perro nonstopword vecina
perro stopword stopword vecina
perro nonstopword nonstopword vecina
perro stopword nonstopword vecina
6 rows selected.
|
|
|
Goto Forum:
Current Time: Thu Jan 30 19:05:28 CST 2025
|