aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/user.rb2
-rw-r--r--spec/fixtures/users.yml5
-rw-r--r--spec/models/xapian_spec.rb21
-rw-r--r--todo.txt5
4 files changed, 31 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 8b99cb61e..f9f1a99cf 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -51,7 +51,7 @@ class User < ActiveRecord::Base
'super',
]
- acts_as_xapian :texts => [ :name ],
+ acts_as_xapian :texts => [ :name, :about_me ],
:values => [
[ :created_at_numeric, 1, "created_at", :number ] # for sorting
],
diff --git a/spec/fixtures/users.yml b/spec/fixtures/users.yml
index 276909cf5..2485c95a0 100644
--- a/spec/fixtures/users.yml
+++ b/spec/fixtures/users.yml
@@ -10,6 +10,7 @@ bob_smith_user:
email_confirmed: true
admin_level: 'none'
ban_text: ''
+ about_me: 'I like making requests about fancy dogs and naughty chickens and stuff.'
silly_name_user:
id: "2"
name: "Silly <em>Name</em>"
@@ -22,6 +23,7 @@ silly_name_user:
email_confirmed: false
admin_level: 'none'
ban_text: ''
+ about_me: ''
admin_user:
id: "3"
name: Joe Admin
@@ -33,4 +35,5 @@ admin_user:
created_at: 2007-11-01 10:39:15.491593
email_confirmed: false
admin_level: 'super'
- ban_text: '' \ No newline at end of file
+ ban_text: ''
+ about_me: ''
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb
index c2a87b969..dd7711a7d 100644
--- a/spec/models/xapian_spec.rb
+++ b/spec/models/xapian_spec.rb
@@ -10,6 +10,27 @@ describe User, " when indexing users with Xapian" do
xapian_object.results.size.should == 1
xapian_object.results[0][:model].should == users(:silly_name_user)
end
+
+ it "should search by 'about me' text" do
+ user = users(:bob_smith_user)
+
+ rebuild_xapian_index
+ # def InfoRequest.full_search(models, query, order, ascending, collapse, per_page, page)
+ xapian_object = InfoRequest.full_search([User], "stuff", 'created_at', true, nil, 100, 1)
+ xapian_object.results.size.should == 1
+ xapian_object.results[0][:model].should == user
+
+ user.about_me = "I am really an aardvark, true story."
+ user.save!
+ update_xapian_index
+
+ xapian_object = InfoRequest.full_search([User], "stuff", 'created_at', true, nil, 100, 1)
+ xapian_object.results.size.should == 0
+
+ xapian_object = InfoRequest.full_search([User], "aardvark", 'created_at', true, nil, 100, 1)
+ xapian_object.results.size.should == 1
+ xapian_object.results[0][:model].should == user
+ end
end
describe PublicBody, " when indexing public bodies with Xapian" do
diff --git a/todo.txt b/todo.txt
index cbcf2efd4..822a7313a 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,3 +1,8 @@
+Profile photo:
+* Check tests all run fine
+* Add search indexing of the text
+
+
Next (things that will reduce admin time mainly)
====