resource_index 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +27 -10
- data/lib/resource_index/search_engine.rb +2 -2
- data/lib/resource_index/version.rb +5 -3
- data/test/dummy/db/resource_index/thing/iamchert +1 -1
- data/test/dummy/db/resource_index/thing/position.DB +0 -0
- data/test/dummy/db/resource_index/thing/postlist.DB +0 -0
- data/test/dummy/db/resource_index/thing/spelling.DB +0 -0
- data/test/dummy/db/resource_index/thing/termlist.DB +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +1 -0
- data/test/dummy/log/test.log +192 -0
- data/test/dummy/test/unit/thing_test.rb +8 -0
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
=
|
1
|
+
= Resource Index
|
2
2
|
|
3
3
|
Uses Xapian index search to speed up searching ActiveResource objects and reduce
|
4
|
-
calls to backend
|
4
|
+
calls to backend services.
|
5
5
|
|
6
6
|
ActiveResource is good for gathering all objects or one object from a remote
|
7
7
|
service api. ResourceIndex provides tools to help you identify the one from
|
@@ -27,21 +27,18 @@ the 'xapian-ruby' gem.
|
|
27
27
|
|
28
28
|
However, if you already have xapian installed, or wish to use a shared
|
29
29
|
Xapian engine, you may wish to install Xapian and the ruby bindings manually.
|
30
|
-
For installation information see: http://xapian.org
|
30
|
+
For installation information see: http://xapian.org
|
31
31
|
|
32
32
|
|
33
33
|
== Usage
|
34
34
|
|
35
|
-
Extend ResourceIndex::SearchEngine on any objects you wish to use ResourceIndex.
|
36
|
-
For example:
|
37
|
-
|
38
35
|
class Thing < ActiveResource::Base
|
39
36
|
|
40
37
|
extend ResourceIndex::SearchEngine
|
41
38
|
|
42
39
|
end
|
43
40
|
|
44
|
-
Thing
|
41
|
+
Thing gets the the following class methods:
|
45
42
|
|
46
43
|
[Thing.search] The main method used to find objects
|
47
44
|
|
@@ -83,6 +80,15 @@ will be installed at /db/resource_index. You can specify a different location:
|
|
83
80
|
If you specify the location, the path to that location should exist or you will
|
84
81
|
get errors.
|
85
82
|
|
83
|
+
Each indexed object gets its own folder within the search root, so you do not
|
84
|
+
have to specify a root for each object. For example, the index files for Thing
|
85
|
+
will be created in db/resource_index/thing/
|
86
|
+
|
87
|
+
To prevent these files being version controlled, add this to your project root
|
88
|
+
.gitignore file (or equivalent):
|
89
|
+
|
90
|
+
/db/resource_index/*
|
91
|
+
|
86
92
|
=== Populate Search Engine
|
87
93
|
|
88
94
|
The populate_search_engine method will replace the existing Xapian database
|
@@ -90,10 +96,9 @@ with one populated from all the objects currently returned by the remote service
|
|
90
96
|
|
91
97
|
Thing.populate_search_engine
|
92
98
|
|
93
|
-
|
99
|
+
This will add all the things gathered by Thing.all, and create index entries for them.
|
94
100
|
|
95
|
-
There is also a rake task
|
96
|
-
example by a cron job:
|
101
|
+
There is also a rake task that runs this method on a given resource:
|
97
102
|
|
98
103
|
rake resource_index:populate resource=Thing
|
99
104
|
|
@@ -112,3 +117,15 @@ search:
|
|
112
117
|
puts "Did you mean '#{results.corrected_query}'" --> "Did you mean 'moose'"
|
113
118
|
end
|
114
119
|
|
120
|
+
=== Search options
|
121
|
+
|
122
|
+
You can pass options through to the underlying xapian_fu object.
|
123
|
+
See https://github.com/johnl/xapian-fu
|
124
|
+
|
125
|
+
For example:
|
126
|
+
|
127
|
+
Thing.search(:all, :page => 1, :per_page => 20)
|
128
|
+
|
129
|
+
Note that by default, search returns the first 10 results.
|
130
|
+
|
131
|
+
|
@@ -1,17 +1,19 @@
|
|
1
1
|
module ResourceIndex
|
2
|
-
VERSION = "0.0.
|
2
|
+
VERSION = "0.0.3"
|
3
3
|
end
|
4
4
|
|
5
5
|
# History
|
6
6
|
# =======
|
7
7
|
#
|
8
|
-
# Version 0.0.
|
8
|
+
# Version 0.0.3
|
9
9
|
# -------------
|
10
|
+
# Adds facility to pass xapian_fu options through from search call.
|
10
11
|
#
|
12
|
+
# Version 0.0.2
|
13
|
+
# -------------
|
11
14
|
# Removes dependency on xapian-ruby. This is now a recommended option
|
12
15
|
#
|
13
16
|
# Version 0.0.1
|
14
17
|
# -------------
|
15
|
-
#
|
16
18
|
# Initial release
|
17
19
|
#
|
@@ -1 +1 @@
|
|
1
|
-
IAmChert��
|
1
|
+
IAmChert��(r�b�dN���,�]
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -34,3 +34,4 @@ Connecting to database specified by database.yml
|
|
34
34
|
Connecting to database specified by database.yml
|
35
35
|
[1m[36mThing Load (0.2ms)[0m [1mSELECT "things".* FROM "things" LIMIT 1[0m
|
36
36
|
[1m[35mThing Load (0.2ms)[0m SELECT "things".* FROM "things"
|
37
|
+
Connecting to database specified by database.yml
|
data/test/dummy/log/test.log
CHANGED
@@ -3050,3 +3050,195 @@ Connecting to database specified by database.yml
|
|
3050
3050
|
[1m[35m (0.1ms)[0m rollback transaction
|
3051
3051
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3052
3052
|
[1m[35m (0.1ms)[0m rollback transaction
|
3053
|
+
Connecting to database specified by database.yml
|
3054
|
+
[1m[36m (2.6ms)[0m [1mbegin transaction[0m
|
3055
|
+
[1m[35mFixture Delete (2.6ms)[0m DELETE FROM "things"
|
3056
|
+
[1m[36mFixture Insert (1.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (1, 'DAVIS', 'ED GAUGHAN', '2013-02-20 11:44:12', '2013-02-20 11:44:12')[0m
|
3057
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (2, 'BENNETT', 'ANDREW BUCKLEY', '2013-02-20 11:44:12', '2013-02-20 11:44:12')
|
3058
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (3, 'THE COLONEL', 'JASON ISAACS', '2013-02-20 11:44:12', '2013-02-20 11:44:12')[0m
|
3059
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (4, 'JANE', 'PAPRIKA STEEN', '2013-02-20 11:44:12', '2013-02-20 11:44:12')
|
3060
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (5, 'REBECCA', 'TUPPENCE MIDDLETON', '2013-02-20 11:44:12', '2013-02-20 11:44:12')[0m
|
3061
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (6, 'JO-JO', 'JOSEF WHITFIELD', '2013-02-20 11:44:12', '2013-02-20 11:44:12')
|
3062
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (7, 'WRITER/DIRECTOR', 'NICK WHITFIELD', '2013-02-20 11:44:12', '2013-02-20 11:44:12')[0m
|
3063
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (8, 'PRODUCER', 'TRACY BRIMM', '2013-02-20 11:44:12', '2013-02-20 11:44:12')
|
3064
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (9, 'PRODUCER', 'KATE MYERS', '2013-02-20 11:44:12', '2013-02-20 11:44:12')[0m
|
3065
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (10, 'PRODUCER', 'PAUL WELSH', '2013-02-20 11:44:12', '2013-02-20 11:44:12')
|
3066
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (11, 'EXECUTIVE PRODUCER', 'SUZANNE ALIZART', '2013-02-20 11:44:12', '2013-02-20 11:44:12')[0m
|
3067
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (12, 'EXECUTIVE PRODUCER', 'ROBBIE ALLEN', '2013-02-20 11:44:12', '2013-02-20 11:44:12')
|
3068
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (13, 'EXECUTIVE PRODUCER', 'ANNA SEIFERT-SPECK', '2013-02-20 11:44:12', '2013-02-20 11:44:12')[0m
|
3069
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (14, 'DIRECTOR OF PHOTOGRAPHY', 'ZAC NICHOLSON', '2013-02-20 11:44:12', '2013-02-20 11:44:12')
|
3070
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (15, 'EDITOR', 'RACHEL TUNNARD', '2013-02-20 11:44:12', '2013-02-20 11:44:12')[0m
|
3071
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (16, 'COMPOSER', 'SIMON WHITFIELD', '2013-02-20 11:44:12', '2013-02-20 11:44:12')
|
3072
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (17, 'PRODUCTION DESIGN', 'JAMES LAPSLEY', '2013-02-20 11:44:12', '2013-02-20 11:44:12')[0m
|
3073
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (18, 'HAIR & MAKE UP DESIGN', 'SUSANNA PERETZ', '2013-02-20 11:44:12', '2013-02-20 11:44:12')
|
3074
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (19, 'COSTUME DESIGN', 'ALISON MCLAUGHLIN', '2013-02-20 11:44:12', '2013-02-20 11:44:12')[0m
|
3075
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (20, 'SUPERVISING SOUND EDITOR', 'JOAKIM SUNDSTROM', '2013-02-20 11:44:12', '2013-02-20 11:44:12')
|
3076
|
+
[1m[36m (334.7ms)[0m [1mcommit transaction[0m
|
3077
|
+
[1m[35m (0.2ms)[0m begin transaction
|
3078
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3079
|
+
[1m[35m (0.2ms)[0m begin transaction
|
3080
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3081
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3082
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3083
|
+
[1m[35m (1.0ms)[0m begin transaction
|
3084
|
+
[1m[36mThing Load (0.3ms)[0m [1mSELECT "things".* FROM "things" LIMIT 1[0m
|
3085
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3086
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3087
|
+
[1m[35mThing Load (0.2ms)[0m SELECT "things".* FROM "things" LIMIT 1
|
3088
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3089
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3090
|
+
[1m[36mThing Load (0.2ms)[0m [1mSELECT "things".* FROM "things" LIMIT 1[0m
|
3091
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3092
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3093
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3094
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3095
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3096
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3097
|
+
[1m[35mThing Load (0.1ms)[0m SELECT "things".* FROM "things" LIMIT 1
|
3098
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
3099
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3100
|
+
[1m[36mThing Load (0.5ms)[0m [1mSELECT "things".* FROM "things" LIMIT 1[0m
|
3101
|
+
[1m[35mThing Load (0.5ms)[0m SELECT "things".* FROM "things"
|
3102
|
+
[1m[36m (0.6ms)[0m [1mSELECT COUNT(*) FROM "things" [0m
|
3103
|
+
[1m[35mThing Load (0.3ms)[0m SELECT "things".* FROM "things" LIMIT 1
|
3104
|
+
[1m[36m (0.3ms)[0m [1mrollback transaction[0m
|
3105
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3106
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3107
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3108
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3109
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3110
|
+
[1m[36mThing Load (0.3ms)[0m [1mSELECT "things".* FROM "things" WHERE (role LIKE '%PRODUCER%')[0m
|
3111
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3112
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3113
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3114
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3115
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "things"
|
3116
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3117
|
+
Connecting to database specified by database.yml
|
3118
|
+
[1m[36m (1.9ms)[0m [1mbegin transaction[0m
|
3119
|
+
[1m[35mFixture Delete (2.8ms)[0m DELETE FROM "things"
|
3120
|
+
[1m[36mFixture Insert (0.9ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (1, 'DAVIS', 'ED GAUGHAN', '2013-02-20 11:45:07', '2013-02-20 11:45:07')[0m
|
3121
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (2, 'BENNETT', 'ANDREW BUCKLEY', '2013-02-20 11:45:07', '2013-02-20 11:45:07')
|
3122
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (3, 'THE COLONEL', 'JASON ISAACS', '2013-02-20 11:45:07', '2013-02-20 11:45:07')[0m
|
3123
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (4, 'JANE', 'PAPRIKA STEEN', '2013-02-20 11:45:07', '2013-02-20 11:45:07')
|
3124
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (5, 'REBECCA', 'TUPPENCE MIDDLETON', '2013-02-20 11:45:07', '2013-02-20 11:45:07')[0m
|
3125
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (6, 'JO-JO', 'JOSEF WHITFIELD', '2013-02-20 11:45:07', '2013-02-20 11:45:07')
|
3126
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (7, 'WRITER/DIRECTOR', 'NICK WHITFIELD', '2013-02-20 11:45:07', '2013-02-20 11:45:07')[0m
|
3127
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (8, 'PRODUCER', 'TRACY BRIMM', '2013-02-20 11:45:07', '2013-02-20 11:45:07')
|
3128
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (9, 'PRODUCER', 'KATE MYERS', '2013-02-20 11:45:07', '2013-02-20 11:45:07')[0m
|
3129
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (10, 'PRODUCER', 'PAUL WELSH', '2013-02-20 11:45:07', '2013-02-20 11:45:07')
|
3130
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (11, 'EXECUTIVE PRODUCER', 'SUZANNE ALIZART', '2013-02-20 11:45:07', '2013-02-20 11:45:07')[0m
|
3131
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (12, 'EXECUTIVE PRODUCER', 'ROBBIE ALLEN', '2013-02-20 11:45:07', '2013-02-20 11:45:07')
|
3132
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (13, 'EXECUTIVE PRODUCER', 'ANNA SEIFERT-SPECK', '2013-02-20 11:45:07', '2013-02-20 11:45:07')[0m
|
3133
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (14, 'DIRECTOR OF PHOTOGRAPHY', 'ZAC NICHOLSON', '2013-02-20 11:45:07', '2013-02-20 11:45:07')
|
3134
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (15, 'EDITOR', 'RACHEL TUNNARD', '2013-02-20 11:45:07', '2013-02-20 11:45:07')[0m
|
3135
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (16, 'COMPOSER', 'SIMON WHITFIELD', '2013-02-20 11:45:07', '2013-02-20 11:45:07')
|
3136
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (17, 'PRODUCTION DESIGN', 'JAMES LAPSLEY', '2013-02-20 11:45:07', '2013-02-20 11:45:07')[0m
|
3137
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (18, 'HAIR & MAKE UP DESIGN', 'SUSANNA PERETZ', '2013-02-20 11:45:07', '2013-02-20 11:45:07')
|
3138
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (19, 'COSTUME DESIGN', 'ALISON MCLAUGHLIN', '2013-02-20 11:45:07', '2013-02-20 11:45:07')[0m
|
3139
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (20, 'SUPERVISING SOUND EDITOR', 'JOAKIM SUNDSTROM', '2013-02-20 11:45:07', '2013-02-20 11:45:07')
|
3140
|
+
[1m[36m (318.6ms)[0m [1mcommit transaction[0m
|
3141
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3142
|
+
[1m[36m (0.6ms)[0m [1mrollback transaction[0m
|
3143
|
+
[1m[35m (0.2ms)[0m begin transaction
|
3144
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3145
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3146
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3147
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3148
|
+
[1m[36mThing Load (0.4ms)[0m [1mSELECT "things".* FROM "things" LIMIT 1[0m
|
3149
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3150
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3151
|
+
[1m[35mThing Load (2.0ms)[0m SELECT "things".* FROM "things" LIMIT 1
|
3152
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3153
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3154
|
+
[1m[36mThing Load (0.2ms)[0m [1mSELECT "things".* FROM "things" LIMIT 1[0m
|
3155
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3156
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3157
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3158
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3159
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3160
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3161
|
+
[1m[35mThing Load (0.2ms)[0m SELECT "things".* FROM "things" LIMIT 1
|
3162
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3163
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3164
|
+
[1m[36mThing Load (0.2ms)[0m [1mSELECT "things".* FROM "things" LIMIT 1[0m
|
3165
|
+
[1m[35mThing Load (0.2ms)[0m SELECT "things".* FROM "things"
|
3166
|
+
[1m[36m (0.6ms)[0m [1mSELECT COUNT(*) FROM "things" [0m
|
3167
|
+
[1m[35mThing Load (0.2ms)[0m SELECT "things".* FROM "things" LIMIT 1
|
3168
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
3169
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3170
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3171
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3172
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3173
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3174
|
+
[1m[36mThing Load (0.3ms)[0m [1mSELECT "things".* FROM "things" WHERE (role LIKE '%PRODUCER%')[0m
|
3175
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3176
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3177
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3178
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3179
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "things"
|
3180
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3181
|
+
Connecting to database specified by database.yml
|
3182
|
+
[1m[36m (2.3ms)[0m [1mbegin transaction[0m
|
3183
|
+
[1m[35mFixture Delete (3.1ms)[0m DELETE FROM "things"
|
3184
|
+
[1m[36mFixture Insert (0.8ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (1, 'DAVIS', 'ED GAUGHAN', '2013-02-20 11:45:40', '2013-02-20 11:45:40')[0m
|
3185
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (2, 'BENNETT', 'ANDREW BUCKLEY', '2013-02-20 11:45:40', '2013-02-20 11:45:40')
|
3186
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (3, 'THE COLONEL', 'JASON ISAACS', '2013-02-20 11:45:40', '2013-02-20 11:45:40')[0m
|
3187
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (4, 'JANE', 'PAPRIKA STEEN', '2013-02-20 11:45:40', '2013-02-20 11:45:40')
|
3188
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (5, 'REBECCA', 'TUPPENCE MIDDLETON', '2013-02-20 11:45:40', '2013-02-20 11:45:40')[0m
|
3189
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (6, 'JO-JO', 'JOSEF WHITFIELD', '2013-02-20 11:45:40', '2013-02-20 11:45:40')
|
3190
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (7, 'WRITER/DIRECTOR', 'NICK WHITFIELD', '2013-02-20 11:45:40', '2013-02-20 11:45:40')[0m
|
3191
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (8, 'PRODUCER', 'TRACY BRIMM', '2013-02-20 11:45:40', '2013-02-20 11:45:40')
|
3192
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (9, 'PRODUCER', 'KATE MYERS', '2013-02-20 11:45:40', '2013-02-20 11:45:40')[0m
|
3193
|
+
[1m[35mFixture Insert (1.9ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (10, 'PRODUCER', 'PAUL WELSH', '2013-02-20 11:45:40', '2013-02-20 11:45:40')
|
3194
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (11, 'EXECUTIVE PRODUCER', 'SUZANNE ALIZART', '2013-02-20 11:45:40', '2013-02-20 11:45:40')[0m
|
3195
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (12, 'EXECUTIVE PRODUCER', 'ROBBIE ALLEN', '2013-02-20 11:45:40', '2013-02-20 11:45:40')
|
3196
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (13, 'EXECUTIVE PRODUCER', 'ANNA SEIFERT-SPECK', '2013-02-20 11:45:40', '2013-02-20 11:45:40')[0m
|
3197
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (14, 'DIRECTOR OF PHOTOGRAPHY', 'ZAC NICHOLSON', '2013-02-20 11:45:40', '2013-02-20 11:45:40')
|
3198
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (15, 'EDITOR', 'RACHEL TUNNARD', '2013-02-20 11:45:40', '2013-02-20 11:45:40')[0m
|
3199
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (16, 'COMPOSER', 'SIMON WHITFIELD', '2013-02-20 11:45:40', '2013-02-20 11:45:40')
|
3200
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (17, 'PRODUCTION DESIGN', 'JAMES LAPSLEY', '2013-02-20 11:45:40', '2013-02-20 11:45:40')[0m
|
3201
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (18, 'HAIR & MAKE UP DESIGN', 'SUSANNA PERETZ', '2013-02-20 11:45:40', '2013-02-20 11:45:40')
|
3202
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (19, 'COSTUME DESIGN', 'ALISON MCLAUGHLIN', '2013-02-20 11:45:40', '2013-02-20 11:45:40')[0m
|
3203
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "things" ("id", "role", "name", "created_at", "updated_at") VALUES (20, 'SUPERVISING SOUND EDITOR', 'JOAKIM SUNDSTROM', '2013-02-20 11:45:40', '2013-02-20 11:45:40')
|
3204
|
+
[1m[36m (193.2ms)[0m [1mcommit transaction[0m
|
3205
|
+
[1m[35m (0.2ms)[0m begin transaction
|
3206
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
3207
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3208
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3209
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3210
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3211
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3212
|
+
[1m[36mThing Load (0.2ms)[0m [1mSELECT "things".* FROM "things" LIMIT 1[0m
|
3213
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3214
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3215
|
+
[1m[35mThing Load (0.2ms)[0m SELECT "things".* FROM "things" LIMIT 1
|
3216
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3217
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3218
|
+
[1m[36mThing Load (0.2ms)[0m [1mSELECT "things".* FROM "things" LIMIT 1[0m
|
3219
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3220
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3221
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3222
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3223
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3224
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3225
|
+
[1m[35mThing Load (0.2ms)[0m SELECT "things".* FROM "things" LIMIT 1
|
3226
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3227
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3228
|
+
[1m[36mThing Load (0.3ms)[0m [1mSELECT "things".* FROM "things" LIMIT 1[0m
|
3229
|
+
[1m[35mThing Load (0.2ms)[0m SELECT "things".* FROM "things"
|
3230
|
+
[1m[36m (0.5ms)[0m [1mSELECT COUNT(*) FROM "things" [0m
|
3231
|
+
[1m[35mThing Load (0.1ms)[0m SELECT "things".* FROM "things" LIMIT 1
|
3232
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
3233
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3234
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3235
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3236
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3237
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3238
|
+
[1m[36mThing Load (0.2ms)[0m [1mSELECT "things".* FROM "things" WHERE (role LIKE '%PRODUCER%')[0m
|
3239
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3240
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3241
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3242
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3243
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "things"
|
3244
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
@@ -34,4 +34,12 @@ class ThingTest < ActiveSupport::TestCase
|
|
34
34
|
assert_equal(producers.length, things.length)
|
35
35
|
assert_equal(producers.collect(&:id).sort, things.collect(&:id).sort)
|
36
36
|
end
|
37
|
+
|
38
|
+
def test_search_with_pagination
|
39
|
+
thing_count = Thing.count
|
40
|
+
[1, 5, 10, 15, 20, 30].each do |page_length|
|
41
|
+
expected = page_length > thing_count ? thing_count : page_length
|
42
|
+
assert_equal(expected, Thing.search(:all, :page => 1, :per_page => page_length).length)
|
43
|
+
end
|
44
|
+
end
|
37
45
|
end
|