Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1.  
  2. -- 1
  3. create table cytaty_new as select * from ZSBD_TOOLS.cytaty;
  4.  
  5.  
  6. -- 2
  7. select *
  8. from cytaty_new
  9. where lower(tekst) LIKE '%pesymista%' OR lower(tekst) LIKE '%optymista%';
  10.  
  11.  
  12. -- 3
  13. create index CYTATY_NEW_IDX on cytaty_new(tekst)
  14. indextype is CTXSYS.CONTEXT;
  15.  
  16.  
  17. -- 4
  18. select *
  19. from cytaty_new
  20. where contains(tekst, 'pesymista') > 0 OR contains(tekst, 'optymista') > 0;
  21.  
  22.  
  23. -- 5
  24. select *
  25. from cytaty_new
  26. where contains(tekst, 'pesymista') > 0 AND contains(tekst, 'optymista') <= 0;
  27.  
  28.  
  29. -- 6
  30. select *
  31. from cytaty_new
  32. where contains(tekst,'near((pesymista, optymista), 3)') > 0;
  33.  
  34.  
  35. -- 7
  36. select *
  37. from cytaty_new
  38. where contains(tekst,'near((pesymista, optymista), 10)') > 0;
  39.  
  40.  
  41. -- 8
  42. select *
  43. from cytaty_new
  44. where contains(tekst, 'życi%') > 0;
  45.  
  46.  
  47. -- 9
  48. select autor, score(1) as score, tekst
  49. from cytaty_new
  50. where contains(tekst, 'życi%', 1) > 0;
  51.  
  52.  
  53. -- 10
  54. select autor, score(1) as score, tekst
  55. from cytaty_new
  56. where contains(tekst, 'życi%', 1) > 0
  57. order by score desc
  58. fetch first row only;
  59.  
  60.  
  61. -- 11 brak
  62. select autor, tekst
  63. from cytaty_new
  64. where contains(tekst, 'fuzzy(probelm)') > 0;
  65.  
  66.  
  67. -- 12
  68. INSERT INTO cytaty_new
  69. (id, autor, tekst)
  70. VALUES
  71. (39, 'Bertrand Russell', 'To smutne, że głupcy są tacy pewni siebie, a ludzie rozsądni tacy pełni wątpliwości.');
  72.  
  73. commit;
  74.  
  75.  
  76. -- 13
  77. select *
  78. from cytaty_new
  79. where contains(tekst, 'głupcy') > 0;
  80.  
  81.  
  82. -- 14
  83. select * from dr$cytaty_new_idx$i; -- i k n u
  84.  
  85.  
  86. -- 15
  87. DROP INDEX CYTATY_NEW_IDX;
  88.  
  89. create index CYTATY_NEW_IDX on cytaty_new(tekst)
  90. indextype is CTXSYS.CONTEXT;
  91.  
  92.  
  93. -- 16
  94. select *
  95. from cytaty_new
  96. where contains(tekst, 'głupcy') > 0;
  97.  
  98.  
  99. -- 17
  100. DROP INDEX CYTATY_NEW_IDX;
  101. drop table cytaty_new;
  102.  
  103.  
  104. -- czesc druga
  105.  
  106. -- 1
  107. create table quotes_new as select * from ZSBD_TOOLS.quotes;
  108.  
  109. -- 2
  110. create index quotes_new_IDX on quotes_new(text)
  111. indextype is CTXSYS.CONTEXT;
  112.  
  113.  
  114. -- 3
  115. select *
  116. from quotes_new
  117. where contains(text, 'work | $work | working | $working') > 0;
  118.  
  119.  
  120. -- 4
  121. select *
  122. from quotes_new
  123. where contains(text, 'it') > 0;
  124.  
  125.  
  126. -- 5
  127. select * from CTX_STOPLISTS;
  128.  
  129.  
  130. -- 6
  131. select * from CTX_STOPWORDS;
  132.  
  133.  
  134. -- 7
  135. DROP INDEX quotes_new_IDX;
  136.  
  137. create index quotes_new_IDX on quotes_new(text)
  138. indextype is CTXSYS.CONTEXT
  139. parameters ('stoplist CTXSYS.EMPTY_STOPLIST');
  140.  
  141.  
  142. -- 8
  143. select *
  144. from quotes_new
  145. where contains(text, 'it') > 0;
  146.  
  147.  
  148. -- 9
  149. select *
  150. from quotes_new
  151. where contains(text, 'fool AND humans') > 0;
  152.  
  153.  
  154. -- 10
  155. select *
  156. from quotes_new
  157. where contains(text, 'fool AND computer') > 0;
  158.  
  159.  
  160. -- 11
  161. select *
  162. from quotes_new
  163. where contains(text, '(fool AND humans) within SENTENCE') > 0;
  164.  
  165.  
  166. -- 12
  167. DROP INDEX quotes_new_IDX;
  168.  
  169.  
  170. -- 13
  171. begin
  172. ctx_ddl.create_section_group('nullgroup', 'NULL_SECTION_GROUP');
  173. ctx_ddl.add_special_section('nullgroup', 'SENTENCE');
  174. ctx_ddl.add_special_section('nullgroup', 'PARAGRAPH');
  175. end;
  176. /
  177.  
  178.  
  179. -- 14
  180. create index quotes_new_IDX on quotes_new(text)
  181. indextype is CTXSYS.CONTEXT
  182. parameters ('stoplist CTXSYS.EMPTY_STOPLIST
  183. section group nullgroup');
  184.  
  185.  
  186. -- 15 -- brak
  187. select *
  188. from quotes_new
  189. where contains(text, '(fool AND humans) within SENTENCE') > 0;
  190.  
  191. select *
  192. from quotes_new
  193. where contains(text, '(fool AND computer) within SENTENCE') > 0;
  194.  
  195.  
  196. -- 16
  197. select *
  198. from quotes_new
  199. where contains(text, 'humans') > 0;
  200.  
  201.  
  202. -- 17
  203. DROP INDEX quotes_new_IDX;
  204.  
  205. begin
  206. ctx_ddl.create_preference('lex_z_m','BASIC_LEXER');
  207. ctx_ddl.set_attribute('lex_z_m',
  208. 'printjoins', '_-');
  209. ctx_ddl.set_attribute ('lex_z_m',
  210. 'index_text', 'YES');
  211. end;
  212. /
  213.  
  214. create index quotes_new_IDX on quotes_new(text)
  215. indextype is CTXSYS.CONTEXT
  216. parameters ('stoplist CTXSYS.EMPTY_STOPLIST
  217. section group nullgroup
  218. lexer lex_z_m');
  219.  
  220.  
  221. -- 18
  222. select *
  223. from quotes_new
  224. where contains(text, 'humans') > 0;
  225.  
  226.  
  227. -- 19
  228. select *
  229. from quotes_new
  230. where contains(text, 'non\-humans') > 0;
  231.  
  232.  
  233. -- 20
  234. DROP INDEX quotes_new_IDX;
  235.  
  236. drop table quotes_new;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement