ruby_odeum 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. data/COPYING +504 -0
  2. data/LICENSE +504 -0
  3. data/README +50 -0
  4. data/bin/odeum_mgr +106 -0
  5. data/doc/rdoc/classes/Odeum.html +235 -0
  6. data/doc/rdoc/classes/Odeum.src/M000010.html +25 -0
  7. data/doc/rdoc/classes/Odeum.src/M000011.html +22 -0
  8. data/doc/rdoc/classes/Odeum.src/M000012.html +27 -0
  9. data/doc/rdoc/classes/Odeum.src/M000013.html +27 -0
  10. data/doc/rdoc/classes/Odeum.src/M000014.html +28 -0
  11. data/doc/rdoc/classes/Odeum/Document.html +382 -0
  12. data/doc/rdoc/classes/Odeum/Document.src/M000040.html +25 -0
  13. data/doc/rdoc/classes/Odeum/Document.src/M000041.html +22 -0
  14. data/doc/rdoc/classes/Odeum/Document.src/M000042.html +23 -0
  15. data/doc/rdoc/classes/Odeum/Document.src/M000043.html +23 -0
  16. data/doc/rdoc/classes/Odeum/Document.src/M000044.html +24 -0
  17. data/doc/rdoc/classes/Odeum/Document.src/M000045.html +32 -0
  18. data/doc/rdoc/classes/Odeum/Document.src/M000046.html +22 -0
  19. data/doc/rdoc/classes/Odeum/Document.src/M000047.html +22 -0
  20. data/doc/rdoc/classes/Odeum/Document.src/M000048.html +22 -0
  21. data/doc/rdoc/classes/Odeum/Document.src/M000049.html +22 -0
  22. data/doc/rdoc/classes/Odeum/Document.src/M000050.html +24 -0
  23. data/doc/rdoc/classes/Odeum/Document.src/M000051.html +27 -0
  24. data/doc/rdoc/classes/Odeum/Index.html +662 -0
  25. data/doc/rdoc/classes/Odeum/Index.src/M000015.html +46 -0
  26. data/doc/rdoc/classes/Odeum/Index.src/M000016.html +33 -0
  27. data/doc/rdoc/classes/Odeum/Index.src/M000017.html +35 -0
  28. data/doc/rdoc/classes/Odeum/Index.src/M000018.html +23 -0
  29. data/doc/rdoc/classes/Odeum/Index.src/M000019.html +22 -0
  30. data/doc/rdoc/classes/Odeum/Index.src/M000020.html +22 -0
  31. data/doc/rdoc/classes/Odeum/Index.src/M000021.html +22 -0
  32. data/doc/rdoc/classes/Odeum/Index.src/M000022.html +22 -0
  33. data/doc/rdoc/classes/Odeum/Index.src/M000023.html +22 -0
  34. data/doc/rdoc/classes/Odeum/Index.src/M000024.html +29 -0
  35. data/doc/rdoc/classes/Odeum/Index.src/M000025.html +23 -0
  36. data/doc/rdoc/classes/Odeum/Index.src/M000026.html +24 -0
  37. data/doc/rdoc/classes/Odeum/Index.src/M000027.html +23 -0
  38. data/doc/rdoc/classes/Odeum/Index.src/M000028.html +26 -0
  39. data/doc/rdoc/classes/Odeum/Index.src/M000029.html +24 -0
  40. data/doc/rdoc/classes/Odeum/Index.src/M000030.html +20 -0
  41. data/doc/rdoc/classes/Odeum/Index.src/M000031.html +22 -0
  42. data/doc/rdoc/classes/Odeum/Index.src/M000032.html +22 -0
  43. data/doc/rdoc/classes/Odeum/Index.src/M000033.html +22 -0
  44. data/doc/rdoc/classes/Odeum/Index.src/M000034.html +22 -0
  45. data/doc/rdoc/classes/Odeum/Index.src/M000035.html +20 -0
  46. data/doc/rdoc/classes/Odeum/Index.src/M000036.html +20 -0
  47. data/doc/rdoc/classes/Odeum/Index.src/M000037.html +22 -0
  48. data/doc/rdoc/classes/Odeum/Index.src/M000038.html +22 -0
  49. data/doc/rdoc/classes/Odeum/Index.src/M000039.html +22 -0
  50. data/doc/rdoc/classes/OdeumTest.html +257 -0
  51. data/doc/rdoc/classes/OdeumTest.src/M000001.html +18 -0
  52. data/doc/rdoc/classes/OdeumTest.src/M000002.html +19 -0
  53. data/doc/rdoc/classes/OdeumTest.src/M000003.html +27 -0
  54. data/doc/rdoc/classes/OdeumTest.src/M000004.html +25 -0
  55. data/doc/rdoc/classes/OdeumTest.src/M000005.html +44 -0
  56. data/doc/rdoc/classes/OdeumTest.src/M000006.html +20 -0
  57. data/doc/rdoc/classes/OdeumTest.src/M000007.html +39 -0
  58. data/doc/rdoc/classes/OdeumTest.src/M000008.html +59 -0
  59. data/doc/rdoc/classes/OdeumTest.src/M000009.html +41 -0
  60. data/doc/rdoc/created.rid +1 -0
  61. data/doc/rdoc/files/COPYING.html +756 -0
  62. data/doc/rdoc/files/LICENSE.html +756 -0
  63. data/doc/rdoc/files/README.html +175 -0
  64. data/doc/rdoc/files/ext/odeum_index/odeum_index_c.html +101 -0
  65. data/doc/rdoc/files/test/test_odeum_rb.html +109 -0
  66. data/doc/rdoc/fr_class_index.html +30 -0
  67. data/doc/rdoc/fr_file_index.html +31 -0
  68. data/doc/rdoc/fr_method_index.html +77 -0
  69. data/doc/rdoc/index.html +24 -0
  70. data/doc/rdoc/rdoc-style.css +208 -0
  71. data/ext/odeum_index/cabin.c +2735 -0
  72. data/ext/odeum_index/cabin.h +1040 -0
  73. data/ext/odeum_index/curia.c +1114 -0
  74. data/ext/odeum_index/curia.h +430 -0
  75. data/ext/odeum_index/depot.c +1910 -0
  76. data/ext/odeum_index/depot.h +439 -0
  77. data/ext/odeum_index/extconf.rb +10 -0
  78. data/ext/odeum_index/myconf.c +668 -0
  79. data/ext/odeum_index/myconf.h +523 -0
  80. data/ext/odeum_index/odeum.c +1743 -0
  81. data/ext/odeum_index/odeum.h +541 -0
  82. data/ext/odeum_index/odeum_index.c +991 -0
  83. data/ext/odeum_index/villa.c +1923 -0
  84. data/ext/odeum_index/villa.h +470 -0
  85. data/ext/odeum_index/vista.c +159 -0
  86. data/ext/odeum_index/vista.h +111 -0
  87. data/test/test_odeum.rb +174 -0
  88. metadata +138 -0
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>[]= (Odeum::Document)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre>/**
14
+ * call-seq:
15
+ * doc[attr] = value
16
+ *
17
+ * Adds meta-data to the document. They should be Strings only.
18
+ */
19
+ VALUE Document_addattr(VALUE self, VALUE name, VALUE value) {
20
+ </pre>
21
+ </body>
22
+ </html>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>[] (Odeum::Document)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre>/**
14
+ * call-seq:
15
+ * document[name] -&gt; String
16
+ *
17
+ * Gets the meta-data attribute for the given name. The name must
18
+ * be a String.
19
+ */
20
+ VALUE Document_getattr(VALUE self, VALUE name) {
21
+ </pre>
22
+ </body>
23
+ </html>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>addword (Odeum::Document)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre>/**
14
+ * call-seq:
15
+ * document.addword(normal, asis)
16
+ *
17
+ * The basic call to add a normal and asis version of a word to the
18
+ * document for indexing.
19
+ */
20
+ VALUE Document_addword(VALUE self, VALUE normal, VALUE asis) {
21
+ </pre>
22
+ </body>
23
+ </html>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>add_word_list (Odeum::Document)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre>/**
14
+ * call-seq:
15
+ * document.add_word_list(asis) -&gt; document
16
+ *
17
+ * Takes an array of &quot;as-is&quot; words, normalizes them, and puts them in the document.
18
+ * It assumes that the array is composed of asis words and normalizes them
19
+ * before putting them in the document.
20
+ */
21
+ VALUE Document_add_word_list(VALUE self, VALUE asis) {
22
+ </pre>
23
+ </body>
24
+ </html>
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>add_content (Odeum::Document)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre>/**
14
+ * call-seq:
15
+ * document.add_content(content) -&gt; document
16
+ *
17
+ * Takes the contents, breaks the words up, and then puts them in the document
18
+ * in normalized form. This is the common pattern that people use a Document
19
+ * with. You may also use Document.addword to add one word a time, and
20
+ * Document.add_word_list to add a list of words.
21
+ *
22
+ * It uses the default Odeum::breaktext method to break up the text,
23
+ * so don't use this if you need specialized stuffs.
24
+ *
25
+ * If the process of normalizing a word creates an empty word, then it
26
+ * is not added to the document's words. This usually happens for
27
+ * punctation that isn't usualy searched for anyway.
28
+ */
29
+ VALUE Document_add_content(VALUE self, VALUE content) {
30
+ </pre>
31
+ </body>
32
+ </html>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>id (Odeum::Document)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre>/**
14
+ * call-seq:
15
+ * document.id -&gt; Fixnum
16
+ *
17
+ * Gives you the Odeum::Index id used to for the document.
18
+ */
19
+ VALUE Document_id(VALUE self) {
20
+ </pre>
21
+ </body>
22
+ </html>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>uri (Odeum::Document)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre>/**
14
+ * call-seq:
15
+ * document.uri -&gt; String
16
+ *
17
+ * Gets the uri that this document represents.
18
+ */
19
+ VALUE Document_uri(VALUE self) {
20
+ </pre>
21
+ </body>
22
+ </html>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>normal_words (Odeum::Document)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre>/**
14
+ * call-seq:
15
+ * document.normal_words -&gt; [word1, word2, ... ]
16
+ *
17
+ * Returns the list of &quot;normal&quot; words in this document.
18
+ */
19
+ VALUE Document_normal_words(VALUE self) {
20
+ </pre>
21
+ </body>
22
+ </html>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>asis_words (Odeum::Document)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre>/**
14
+ * call-seq:
15
+ * document.asis_words -&gt; [word1, word2, ...]
16
+ *
17
+ * Returns all of the asis or &quot;appearance form&quot; words in the document.
18
+ */
19
+ VALUE Document_asis_words(VALUE self) {
20
+ </pre>
21
+ </body>
22
+ </html>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>scores (Odeum::Document)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre>/**
14
+ * call-seq:
15
+ * document.scores(max, index) -&gt; { word =&gt; score, word =&gt; score, ...}
16
+ *
17
+ * Get the normalized words and their scores in the document. The
18
+ * strange thing is that the scores are returned as Strings, but they
19
+ * are decimal strings.
20
+ */
21
+ VALUE Document_scores(VALUE self, VALUE max, VALUE odeum_obj) {
22
+ </pre>
23
+ </body>
24
+ </html>
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>close (Odeum::Document)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre>/**
14
+ * call-seq:
15
+ * doc.close -&gt; nil
16
+ *
17
+ * Explicitly closes a document. Because of what I can only decide is a bug
18
+ * in how an each iterator works, you must explicitly close a document
19
+ * if you are not storing it and you are in an each. There are probably
20
+ * subtle things about Ruby memory management I'm missing, but my tests
21
+ * show that all Document objects created with Index.get do not get
22
+ * garbage collected until they exit a block.
23
+ */
24
+ VALUE Document_close(VALUE self) {
25
+ </pre>
26
+ </body>
27
+ </html>
@@ -0,0 +1,662 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Odeum::Index</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Odeum::Index</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/ext/odeum_index/odeum_index_c.html">
59
+ ext/odeum_index/odeum_index.c
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000032">bucket_count</a>&nbsp;&nbsp;
90
+ <a href="#M000033">buckets_used</a>&nbsp;&nbsp;
91
+ <a href="#M000023">check</a>&nbsp;&nbsp;
92
+ <a href="#M000016">close</a>&nbsp;&nbsp;
93
+ <a href="#M000018">delete</a>&nbsp;&nbsp;
94
+ <a href="#M000019">delete_by_id</a>&nbsp;&nbsp;
95
+ <a href="#M000034">doc_count</a>&nbsp;&nbsp;
96
+ <a href="#M000037">fatal_error</a>&nbsp;&nbsp;
97
+ <a href="#M000020">get</a>&nbsp;&nbsp;
98
+ <a href="#M000021">get_by_id</a>&nbsp;&nbsp;
99
+ <a href="#M000022">get_id_by_uri</a>&nbsp;&nbsp;
100
+ <a href="#M000038">inode</a>&nbsp;&nbsp;
101
+ <a href="#M000026">iterator</a>&nbsp;&nbsp;
102
+ <a href="#M000039">mtime</a>&nbsp;&nbsp;
103
+ <a href="#M000030">name</a>&nbsp;&nbsp;
104
+ <a href="#M000015">new</a>&nbsp;&nbsp;
105
+ <a href="#M000027">next</a>&nbsp;&nbsp;
106
+ <a href="#M000029">optimize</a>&nbsp;&nbsp;
107
+ <a href="#M000017">put</a>&nbsp;&nbsp;
108
+ <a href="#M000024">search</a>&nbsp;&nbsp;
109
+ <a href="#M000025">search_doc_count</a>&nbsp;&nbsp;
110
+ <a href="#M000031">size</a>&nbsp;&nbsp;
111
+ <a href="#M000028">sync</a>&nbsp;&nbsp;
112
+ <a href="#M000035">word_count</a>&nbsp;&nbsp;
113
+ <a href="#M000036">writable</a>&nbsp;&nbsp;
114
+ </div>
115
+ </div>
116
+
117
+ </div>
118
+
119
+
120
+ <!-- if includes -->
121
+
122
+ <div id="section">
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+ <!-- if method_list -->
132
+ <div id="methods">
133
+ <h3 class="section-bar">Public Class methods</h3>
134
+
135
+ <div id="method-M000015" class="method-detail">
136
+ <a name="M000015"></a>
137
+
138
+ <div class="method-heading">
139
+ <a href="Index.src/M000015.html" target="Code" class="method-signature"
140
+ onclick="popupCode('Index.src/M000015.html');return false;">
141
+ <span class="method-name">Index.new(name, mode) &rarr; Index<br />
142
+ </span>
143
+ </a>
144
+ </div>
145
+
146
+ <div class="method-description">
147
+ <p>
148
+ Creates an <a href="Index.html">Index</a> with the given name according to
149
+ mode. The name will be used as the basis for a local directory which will
150
+ contain the database for the documents.
151
+ </p>
152
+ <p>
153
+ Possible modes might be:
154
+ </p>
155
+ <ul>
156
+ <li>Odeum::OWRITER &#8212; Opens as a writer.
157
+
158
+ </li>
159
+ <li>Odeum::OREADER &#8212; Read-only.
160
+
161
+ </li>
162
+ <li>Odeum::OCREAT &#8212; Or&#8216;d in to OWRITER to indicate that you want it
163
+ created if not existing.
164
+
165
+ </li>
166
+ <li>Odeum::ONOLOCK &#8212; Opens without locking on the directory.
167
+
168
+ </li>
169
+ </ul>
170
+ <p>
171
+ Opening as OWRITER creates an exclusive lock on the database dir, but
172
+ OREADER opens with a shared lock. A thread will block until the lock is
173
+ achieved, but none of this has been tested in Ruby with Ruby&#8217;s
174
+ in-process threads.
175
+ </p>
176
+ </div>
177
+ </div>
178
+
179
+ <h3 class="section-bar">Public Instance methods</h3>
180
+
181
+ <div id="method-M000032" class="method-detail">
182
+ <a name="M000032"></a>
183
+
184
+ <div class="method-heading">
185
+ <a href="Index.src/M000032.html" target="Code" class="method-signature"
186
+ onclick="popupCode('Index.src/M000032.html');return false;">
187
+ <span class="method-name">index.bucket_count &rarr; Fixnum<br />
188
+ </span>
189
+ </a>
190
+ </div>
191
+
192
+ <div class="method-description">
193
+ <p>
194
+ Returns the total number of elements of the bucket arrays, or -1 on
195
+ failure.
196
+ </p>
197
+ </div>
198
+ </div>
199
+
200
+ <div id="method-M000033" class="method-detail">
201
+ <a name="M000033"></a>
202
+
203
+ <div class="method-heading">
204
+ <a href="Index.src/M000033.html" target="Code" class="method-signature"
205
+ onclick="popupCode('Index.src/M000033.html');return false;">
206
+ <span class="method-name">index.buckets_used &rarr; Fixnum<br />
207
+ </span>
208
+ </a>
209
+ </div>
210
+
211
+ <div class="method-description">
212
+ <p>
213
+ The total number of used elements of the bucket arrays, or -1 if failure.
214
+ </p>
215
+ </div>
216
+ </div>
217
+
218
+ <div id="method-M000023" class="method-detail">
219
+ <a name="M000023"></a>
220
+
221
+ <div class="method-heading">
222
+ <a href="Index.src/M000023.html" target="Code" class="method-signature"
223
+ onclick="popupCode('Index.src/M000023.html');return false;">
224
+ <span class="method-name">index.check(id)<br />
225
+ </span>
226
+ </a>
227
+ </div>
228
+
229
+ <div class="method-description">
230
+ <p>
231
+ Checks if a document with the given id is in the database.
232
+ </p>
233
+ </div>
234
+ </div>
235
+
236
+ <div id="method-M000016" class="method-detail">
237
+ <a name="M000016"></a>
238
+
239
+ <div class="method-heading">
240
+ <a href="Index.src/M000016.html" target="Code" class="method-signature"
241
+ onclick="popupCode('Index.src/M000016.html');return false;">
242
+ <span class="method-name">Index.close &rarr; true/false<br />
243
+ </span>
244
+ </a>
245
+ </div>
246
+
247
+ <div class="method-description">
248
+ <p>
249
+ Closes the <a href="Index.html">Index</a> explicitly. It will be closed by
250
+ the GC when Index_free is finally called, but don&#8217;t rely on this as
251
+ it is not reliable enough. Don&#8216;t use the index after this, it will
252
+ throw an exception or possibly crash.
253
+ </p>
254
+ </div>
255
+ </div>
256
+
257
+ <div id="method-M000018" class="method-detail">
258
+ <a name="M000018"></a>
259
+
260
+ <div class="method-heading">
261
+ <a href="Index.src/M000018.html" target="Code" class="method-signature"
262
+ onclick="popupCode('Index.src/M000018.html');return false;">
263
+ <span class="method-name">index.delete(uri) &rarr; true/false<br />
264
+ </span>
265
+ </a>
266
+ </div>
267
+
268
+ <div class="method-description">
269
+ <p>
270
+ Deletes the document given by the uri. The <a href="Index.html">Index</a>
271
+ must be opened as a writer, and the call will return false if no such
272
+ document exists.
273
+ </p>
274
+ </div>
275
+ </div>
276
+
277
+ <div id="method-M000019" class="method-detail">
278
+ <a name="M000019"></a>
279
+
280
+ <div class="method-heading">
281
+ <a href="Index.src/M000019.html" target="Code" class="method-signature"
282
+ onclick="popupCode('Index.src/M000019.html');return false;">
283
+ <span class="method-name">index.delete_by_id(id) &rarr; true/false<br />
284
+ </span>
285
+ </a>
286
+ </div>
287
+
288
+ <div class="method-description">
289
+ <p>
290
+ Deletes a document based on its id.
291
+ </p>
292
+ </div>
293
+ </div>
294
+
295
+ <div id="method-M000034" class="method-detail">
296
+ <a name="M000034"></a>
297
+
298
+ <div class="method-heading">
299
+ <a href="Index.src/M000034.html" target="Code" class="method-signature"
300
+ onclick="popupCode('Index.src/M000034.html');return false;">
301
+ <span class="method-name">index.doc_count &rarr; Fixnum<br />
302
+ </span>
303
+ </a>
304
+ </div>
305
+
306
+ <div class="method-description">
307
+ <p>
308
+ Number of documents stored in the database, or -1 on failure.
309
+ </p>
310
+ </div>
311
+ </div>
312
+
313
+ <div id="method-M000037" class="method-detail">
314
+ <a name="M000037"></a>
315
+
316
+ <div class="method-heading">
317
+ <a href="Index.src/M000037.html" target="Code" class="method-signature"
318
+ onclick="popupCode('Index.src/M000037.html');return false;">
319
+ <span class="method-name">index.fatal_error &rarr; Fixnum<br />
320
+ </span>
321
+ </a>
322
+ </div>
323
+
324
+ <div class="method-description">
325
+ <p>
326
+ Returns true if there&#8217;s a fatal error or false otherwise.
327
+ </p>
328
+ </div>
329
+ </div>
330
+
331
+ <div id="method-M000020" class="method-detail">
332
+ <a name="M000020"></a>
333
+
334
+ <div class="method-heading">
335
+ <a href="Index.src/M000020.html" target="Code" class="method-signature"
336
+ onclick="popupCode('Index.src/M000020.html');return false;">
337
+ <span class="method-name">index.get(uri) &rarr; Document<br />
338
+ </span>
339
+ </a>
340
+ </div>
341
+
342
+ <div class="method-description">
343
+ <p>
344
+ Gets a <a href="Document.html">Document</a> based on the uri, or returns
345
+ nil.
346
+ </p>
347
+ </div>
348
+ </div>
349
+
350
+ <div id="method-M000021" class="method-detail">
351
+ <a name="M000021"></a>
352
+
353
+ <div class="method-heading">
354
+ <a href="Index.src/M000021.html" target="Code" class="method-signature"
355
+ onclick="popupCode('Index.src/M000021.html');return false;">
356
+ <span class="method-name">index.get_by_id(id) &rarr; Document<br />
357
+ </span>
358
+ </a>
359
+ </div>
360
+
361
+ <div class="method-description">
362
+ <p>
363
+ Gets a <a href="Document.html">Document</a> based on its id, or nil if that
364
+ document isn&#8217;t there.
365
+ </p>
366
+ </div>
367
+ </div>
368
+
369
+ <div id="method-M000022" class="method-detail">
370
+ <a name="M000022"></a>
371
+
372
+ <div class="method-heading">
373
+ <a href="Index.src/M000022.html" target="Code" class="method-signature"
374
+ onclick="popupCode('Index.src/M000022.html');return false;">
375
+ <span class="method-name">index.get_id_by_uri(id)<br />
376
+ </span>
377
+ </a>
378
+ </div>
379
+
380
+ <div class="method-description">
381
+ <p>
382
+ Returns just the id of the document with the given uri.
383
+ </p>
384
+ </div>
385
+ </div>
386
+
387
+ <div id="method-M000038" class="method-detail">
388
+ <a name="M000038"></a>
389
+
390
+ <div class="method-heading">
391
+ <a href="Index.src/M000038.html" target="Code" class="method-signature"
392
+ onclick="popupCode('Index.src/M000038.html');return false;">
393
+ <span class="method-name">index.inode &rarr; Fixnum<br />
394
+ </span>
395
+ </a>
396
+ </div>
397
+
398
+ <div class="method-description">
399
+ <p>
400
+ The inode number of the database directory.
401
+ </p>
402
+ </div>
403
+ </div>
404
+
405
+ <div id="method-M000026" class="method-detail">
406
+ <a name="M000026"></a>
407
+
408
+ <div class="method-heading">
409
+ <a href="Index.src/M000026.html" target="Code" class="method-signature"
410
+ onclick="popupCode('Index.src/M000026.html');return false;">
411
+ <span class="method-name">index.iterator &rarr; true/false<br />
412
+ </span>
413
+ </a>
414
+ </div>
415
+
416
+ <div class="method-description">
417
+ <p>
418
+ Begins an iterator loop to process documents in the system. An
419
+ iterator/next pattern is used due to the difficulty of getting memory
420
+ collection correct inside an each/block design.
421
+ </p>
422
+ </div>
423
+ </div>
424
+
425
+ <div id="method-M000039" class="method-detail">
426
+ <a name="M000039"></a>
427
+
428
+ <div class="method-heading">
429
+ <a href="Index.src/M000039.html" target="Code" class="method-signature"
430
+ onclick="popupCode('Index.src/M000039.html');return false;">
431
+ <span class="method-name">index.mtime &rarr; Fixnum<br />
432
+ </span>
433
+ </a>
434
+ </div>
435
+
436
+ <div class="method-description">
437
+ <p>
438
+ The mtime of the database directory.
439
+ </p>
440
+ </div>
441
+ </div>
442
+
443
+ <div id="method-M000030" class="method-detail">
444
+ <a name="M000030"></a>
445
+
446
+ <div class="method-heading">
447
+ <a href="Index.src/M000030.html" target="Code" class="method-signature"
448
+ onclick="popupCode('Index.src/M000030.html');return false;">
449
+ <span class="method-name">name</span><span class="method-args">()</span>
450
+ </a>
451
+ </div>
452
+
453
+ <div class="method-description">
454
+ <p>
455
+ call-seq:
456
+ </p>
457
+ <pre>
458
+ index.name -&gt; String
459
+ </pre>
460
+ </div>
461
+ </div>
462
+
463
+ <div id="method-M000027" class="method-detail">
464
+ <a name="M000027"></a>
465
+
466
+ <div class="method-heading">
467
+ <a href="Index.src/M000027.html" target="Code" class="method-signature"
468
+ onclick="popupCode('Index.src/M000027.html');return false;">
469
+ <span class="method-name">index.next &rarr; Document<br />
470
+ </span>
471
+ </a>
472
+ </div>
473
+
474
+ <div class="method-description">
475
+ <p>
476
+ Returns the next document or nil if there was an error. Must call <a
477
+ href="Index.html#M000026">Index.iterator</a> first.
478
+ </p>
479
+ </div>
480
+ </div>
481
+
482
+ <div id="method-M000029" class="method-detail">
483
+ <a name="M000029"></a>
484
+
485
+ <div class="method-heading">
486
+ <a href="Index.src/M000029.html" target="Code" class="method-signature"
487
+ onclick="popupCode('Index.src/M000029.html');return false;">
488
+ <span class="method-name">index.optimize &rarr; true/false<br />
489
+ </span>
490
+ </a>
491
+ </div>
492
+
493
+ <div class="method-description">
494
+ <p>
495
+ Purges deleted documents from the index. I found that if you call this
496
+ while you are updating documents then it stops adding documents after the
497
+ optimize call.
498
+ </p>
499
+ </div>
500
+ </div>
501
+
502
+ <div id="method-M000017" class="method-detail">
503
+ <a name="M000017"></a>
504
+
505
+ <div class="method-heading">
506
+ <a href="Index.src/M000017.html" target="Code" class="method-signature"
507
+ onclick="popupCode('Index.src/M000017.html');return false;">
508
+ <span class="method-name">index.put(doc, wmax, over) &rarr; true/false<br />
509
+ </span>
510
+ </a>
511
+ </div>
512
+
513
+ <div class="method-description">
514
+ <p>
515
+ Puts the <a href="Document.html">Document</a> doc into the <a
516
+ href="Index.html">Index</a>, and indexes a maximum of wmax words in the
517
+ document. If over is true than the document is overwritten in the database.
518
+ Otherwise, if the document already exists in the database and over==
519
+ nil/false then the method will return false as an error.
520
+ </p>
521
+ </div>
522
+ </div>
523
+
524
+ <div id="method-M000024" class="method-detail">
525
+ <a name="M000024"></a>
526
+
527
+ <div class="method-heading">
528
+ <a href="Index.src/M000024.html" target="Code" class="method-signature"
529
+ onclick="popupCode('Index.src/M000024.html');return false;">
530
+ <span class="method-name">index.search(word, max) &rarr; [[id,score], ... ]<br />
531
+ </span>
532
+ </a>
533
+ </div>
534
+
535
+ <div class="method-description">
536
+ <p>
537
+ The big payoff method which actually searches for the documents that have
538
+ the given word mentioned. The result of the search is an array of
539
+ &quot;tuples&quot; with [id, score] and sorted in score order from
540
+ descending order of their scores. If there are no results then it returns
541
+ an empty array.
542
+ </p>
543
+ <p>
544
+ If the search attempt fails for some reason then an exception is thrown,
545
+ but an empty result is NOT a failure (that returns an empty hash).
546
+ </p>
547
+ </div>
548
+ </div>
549
+
550
+ <div id="method-M000025" class="method-detail">
551
+ <a name="M000025"></a>
552
+
553
+ <div class="method-heading">
554
+ <a href="Index.src/M000025.html" target="Code" class="method-signature"
555
+ onclick="popupCode('Index.src/M000025.html');return false;">
556
+ <span class="method-name">index.search_doc_count(word) &rarr; Fixnum<br />
557
+ </span>
558
+ </a>
559
+ </div>
560
+
561
+ <div class="method-description">
562
+ <p>
563
+ Returns the number of document matching the given word. If the word does
564
+ not match anything then it returns -1.
565
+ </p>
566
+ </div>
567
+ </div>
568
+
569
+ <div id="method-M000031" class="method-detail">
570
+ <a name="M000031"></a>
571
+
572
+ <div class="method-heading">
573
+ <a href="Index.src/M000031.html" target="Code" class="method-signature"
574
+ onclick="popupCode('Index.src/M000031.html');return false;">
575
+ <span class="method-name">index.size &rarr; Fixnum<br />
576
+ </span>
577
+ </a>
578
+ </div>
579
+
580
+ <div class="method-description">
581
+ <p>
582
+ Returns the size of the database files or -1 if there&#8217;s a failure.
583
+ </p>
584
+ </div>
585
+ </div>
586
+
587
+ <div id="method-M000028" class="method-detail">
588
+ <a name="M000028"></a>
589
+
590
+ <div class="method-heading">
591
+ <a href="Index.src/M000028.html" target="Code" class="method-signature"
592
+ onclick="popupCode('Index.src/M000028.html');return false;">
593
+ <span class="method-name">index.sync &rarr; true/false<br />
594
+ </span>
595
+ </a>
596
+ </div>
597
+
598
+ <div class="method-description">
599
+ <p>
600
+ Synchronizes any changes you have made with the database. If you
601
+ don&#8217;t do this every once in a while then the memory load will get to
602
+ great. I found that every 1000 documents or so is a good trade-off.
603
+ </p>
604
+ <p>
605
+ Returns true if everything worked, or false otherwise.
606
+ </p>
607
+ </div>
608
+ </div>
609
+
610
+ <div id="method-M000035" class="method-detail">
611
+ <a name="M000035"></a>
612
+
613
+ <div class="method-heading">
614
+ <a href="Index.src/M000035.html" target="Code" class="method-signature"
615
+ onclick="popupCode('Index.src/M000035.html');return false;">
616
+ <span class="method-name">word_count</span><span class="method-args">()</span>
617
+ </a>
618
+ </div>
619
+
620
+ <div class="method-description">
621
+ <p>
622
+ call-seq:
623
+ </p>
624
+ <pre>
625
+ index.word_count -&gt; Fixnum
626
+ </pre>
627
+ </div>
628
+ </div>
629
+
630
+ <div id="method-M000036" class="method-detail">
631
+ <a name="M000036"></a>
632
+
633
+ <div class="method-heading">
634
+ <a href="Index.src/M000036.html" target="Code" class="method-signature"
635
+ onclick="popupCode('Index.src/M000036.html');return false;">
636
+ <span class="method-name">writable</span><span class="method-args">()</span>
637
+ </a>
638
+ </div>
639
+
640
+ <div class="method-description">
641
+ <p>
642
+ call-seq:
643
+ </p>
644
+ <pre>
645
+ index.writable -&gt; true/false
646
+ </pre>
647
+ </div>
648
+ </div>
649
+
650
+
651
+ </div>
652
+
653
+
654
+ </div>
655
+
656
+
657
+ <div id="validator-badges">
658
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
659
+ </div>
660
+
661
+ </body>
662
+ </html>