Home » Server Options » Text & interMedia » oracle text contains near (Oracle 11g)
oracle text contains near [message #294099] Wed, 16 January 2008 07:59 Go to next message
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 #294110 is a reply to message #294099] Wed, 16 January 2008 08:49 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Did you see this a test forum just for testing the way you post and is not meant for getting an answer?

By the way, your code is not formatted, please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel

Re: oracle text contains near [message #295228 is a reply to message #294099] Mon, 21 January 2008 16:54 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9077
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 Go to previous message
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.



Previous Topic: [CONTAINS] No result whereas there are
Next Topic: Oracle Multilingual DB - need information
Goto Forum:
  


Current Time: Fri Mar 29 08:02:34 CDT 2024