Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 7
- Log:
Initial import of RForum 0.2 sources from a downloaded Tarball.
RForum is a Ruby On Rails based forum and mail gateway service.
- Author:
- adh
- Date:
- Sat Jul 22 18:43:13 +0100 2006
- Size:
- 1284 Bytes
1 | require 'odeum_index' |
2 | require 'search' |
3 | |
4 | class SearchOdeum < Search |
5 | def initialize |
6 | @name = 'odeum_index' |
7 | end |
8 | |
9 | def search(query, forum_ids=[]) |
10 | index = Odeum::Index.new @name, Odeum::OREADER |
11 | result = index.query(query) |
12 | posts = [] |
13 | |
14 | while doc = result.next_doc(index) |
15 | posts << Post.find(doc.uri.to_i) |
16 | end |
17 | |
18 | return posts |
19 | ensure |
20 | index.close |
21 | end |
22 | |
23 | def update(post) |
24 | index = Odeum::Index.new(@name, Odeum::OCREAT | Odeum::OWRITER) |
25 | doc = Odeum::Document.new(post.id.to_s) |
26 | doc.add_content(index, post.subject + ' ' + post.text) |
27 | index.put(doc, -1, true) |
28 | index.sync |
29 | ensure |
30 | index.close |
31 | end |
32 | |
33 | def delete(post) |
34 | index = Odeum::Index.new(@name, Odeum::OCREAT | Odeum::OWRITER) |
35 | index.delete(post.id.to_s) |
36 | index.sync |
37 | ensure |
38 | index.close |
39 | end |
40 | |
41 | def rebuild_index |
42 | index = Odeum::Index.new(@name, Odeum::OCREAT | Odeum::OWRITER) |
43 | count = 0 |
44 | Post.find(:all, :conditions => 'deleted=0').each do |post| |
45 | doc = Odeum::Document.new(post.id.to_s) |
46 | doc.add_content(index, post.subject + ' ' + post.text) |
47 | index.put(doc, -1, true) |
48 | doc.close |
49 | count += 1 |
50 | if count == 100 |
51 | index.sync |
52 | count = 0 |
53 | end |
54 | end |
55 | index.sync |
56 | ensure |
57 | index.close |
58 | end |
59 | end |