Commit d05c0c85f33eccb9d72e7ff3d6f502f6f0a5be3a

Authored by Rodrigo Souto
1 parent e7b5205f

Fixing search features

Moving solr specifics to the plugin
app/controllers/public/search_controller.rb
... ... @@ -105,7 +105,7 @@ class SearchController < PublicController
105 105 environment.events.by_day(@selected_day)
106 106 end
107 107  
108   - @scope = date_range ? environment.events.by_range(date_range) : environment.events
  108 + @scope = date_range && params[:action] == :events ? environment.events.by_range(date_range) : environment.events
109 109 full_text_search
110 110  
111 111 events = @searches[@asset][:results]
... ...
app/views/search/events.html.erb
  1 +<%= search_page_title( Environment.default.name + "'s " + _('Events'), @category ) %>
1 2 <%= render :partial => 'events/agenda' %>
... ...
features/browse.feature
... ... @@ -4,7 +4,6 @@ Feature: browse
4 4  
5 5 Background:
6 6 Given I am on the homepage
7   - And the search index is empty
8 7 And the following users
9 8 | login | name |
10 9 | joaosilva | Joao Silva |
... ...
features/profile_search.feature
... ... @@ -4,8 +4,7 @@ Feature: search inside a profile
4 4 In order to find stuff from a profile
5 5  
6 6 Background:
7   - Given the search index is empty
8   - And the following users
  7 + Given the following users
9 8 | login | name |
10 9 | joaosilva | Joao Silva |
11 10 And the following articles
... ...
features/register_enterprise.feature
... ... @@ -201,10 +201,6 @@ Feature: register enterprise
201 201 When I follow "Manage my groups"
202 202 Then I should not see "My Enterprise"
203 203  
204   - Scenario: a user can see button to register new enterprise
205   - When I am on /assets/enterprises
206   - Then I should see "New enterprise" link
207   -
208 204 Scenario: a user cant see button to register new enterprise if enterprise_registration disabled
209 205 Given feature "enterprise_registration" is disabled on environment
210 206 When I am on /assets/enterprises
... ...
features/search.feature
... ... @@ -4,8 +4,7 @@ Feature: search
4 4 In order to find stuff
5 5  
6 6 Background:
7   - Given the search index is empty
8   - And feature "disable_asset_products" is disabled on environment
  7 + Given feature "disable_asset_products" is disabled on environment
9 8  
10 9 Scenario: show empty results in all enabled assets
11 10 Given I go to the search page
... ...
features/search_communities.feature
... ... @@ -4,8 +4,7 @@ Feature: search communities
4 4 In order to find ones that interest me
5 5  
6 6 Background:
7   - Given the search index is empty
8   - And the following category
  7 + Given the following category
9 8 | name |
10 9 | social network |
11 10 And the following community
... ... @@ -34,82 +33,11 @@ Feature: search communities
34 33 And I should see "Noosfero Community" within ".only-one-result-box"
35 34 And I should see Noosfero Community's community image
36 35  
37   - Scenario: search communities by category
38   - Given the following category
39   - | name |
40   - | Software Livre |
41   - And the following community
42   - | identifier | name | category |
43   - | noos-comm | Noosfero Community | software-livre |
44   - When I go to the search communities page
45   - And I fill in "search-input" with "software livre"
46   - And I press "Search"
47   - Then I should see "Noosfero" within "#search-results"
48   -
49   - Scenario: see category facets when searching
50   - Given the following categories as facets
51   - | name |
52   - | Temáticas |
53   - And the following category
54   - | name | parent |
55   - | Software Livre | tematicas |
56   - And the following community
57   - | identifier | name | category |
58   - | linux | Linux Community | software-livre |
59   - When I go to the search communities page
60   - And I fill in "search-input" with "Linux"
61   - And I press "Search"
62   - Then I should see "Temáticas" within "#facets-menu"
63   -
64 36 Scenario: find communities without exact query
65 37 Given the following communities
66 38 | identifier | name |
67 39 | luwac | Linux Users Without a Clue |
68 40 When I go to the search communities page
69   - And I fill in "search-input" with "Linux Clue"
  41 + And I fill in "search-input" with "Linux Users"
70 42 And I press "Search"
71 43 Then I should see "Linux Users Without a Clue" within "#search-results"
72   -
73   - Scenario: filter communities by facet
74   - Given the following categories as facets
75   - | name |
76   - | Temáticas |
77   - And the following category
78   - | name | parent |
79   - | Software Livre | tematicas |
80   - | Big Brother | tematicas |
81   - And the following communities
82   - | identifier | name | category |
83   - | noos-dev | Noosfero Developers | software-livre |
84   - | facebook | Facebook Developers | big-brother |
85   - When I go to the search communities page
86   - And I fill in "search-input" with "Developers"
87   - And I press "Search"
88   - And I follow "Software Livre" within "#facets-menu"
89   - Then I should see "Noosfero Developers" within "#search-results"
90   - And I should not see "Facebook Developers"
91   - # facet should also be de-selectable
92   - When I follow "remove facet" within ".facet-selected"
93   - Then I should see "Facebook Developers"
94   -
95   - Scenario: remember facet filter when searching new query
96   - Given the following categories as facets
97   - | name |
98   - | Temáticas |
99   - And the following category
100   - | name | parent |
101   - | Software Livre | tematicas |
102   - | Other Category | tematicas |
103   - And the following communities
104   - | identifier | name | category |
105   - | noos-dev | Noosfero Developers | software-livre |
106   - | rails-dev | Rails Developers | other-category |
107   - | rails-usr | Rails Users | software-livre |
108   - When I go to the search communities page
109   - And I fill in "search-input" with "Developers"
110   - And I press "Search"
111   - And I follow "Software Livre" within "#facets-menu"
112   - And I fill in "search-input" with "Rails"
113   - And I press "Search"
114   - Then I should see "Rails Users" within "#search-results"
115   - And I should not see "Rails Developers"
... ...
features/search_contents.feature
... ... @@ -4,17 +4,13 @@ Feature: search contents
4 4 In order to find ones that interest me
5 5  
6 6 Background:
7   - Given the search index is empty
8   - And the following users
  7 + Given the following users
9 8 | login | name |
10 9 | joaosilva | Joao Silva |
11 10 And the following articles
12 11 | owner | name | body |
13 12 | joaosilva | bees and butterflies | this is an article about bees and butterflies |
14 13 | joaosilva | whales and dolphins | this is an article about whales and dolphins |
15   - And the following categories as facets
16   - | name |
17   - | Temáticas |
18 14  
19 15 Scenario: show recent content on index
20 16 When I go to the search articles page
... ... @@ -232,23 +228,8 @@ Feature: search contents
232 228 | sglaspell | Susan Glaspell |
233 229 And the article "whales and dolphins" is updated by "Susan Glaspell"
234 230 When I search contents for "whales"
235   - # Then show me the page
236 231 Then I should see "by Susan Glaspell at" within ".search-article-author-changes"
237 232  
238   - Scenario: search articles by category
239   - Given the following category
240   - | name |
241   - | Software Livre |
242   - And the following articles
243   - | owner | name | body | category |
244   - | joaosilva | using noosfero | noosfero is a great CMS | software-livre |
245   - When I go to the search articles page
246   - And I fill in "search-input" with "Software"
247   - And I press "Search"
248   - Then I should see "using noosfero" within "#search-results"
249   - And I should not see "bees and butterflies"
250   - And I should not see "whales and dolphins"
251   -
252 233 Scenario: show basic info on blog search results
253 234 Given the following blogs
254 235 | owner | name |
... ... @@ -284,55 +265,8 @@ Feature: search contents
284 265 When I search contents for "JSilva"
285 266 Then I should see "None" within ".search-blog-items"
286 267  
287   - Scenario: see default facets when searching
288   - When I go to the search articles page
289   - And I fill in "search-input" with "bees"
290   - And I press "Search"
291   - Then I should see "Type" within "#facets-menu"
292   - And I should see "Published date" within "#facets-menu"
293   - And I should see "Profile" within "#facets-menu"
294   - And I should see "Categories" within "#facets-menu"
295   -
296 268 Scenario: find enterprises without exact query
297 269 When I go to the search articles page
298   - And I fill in "search-input" with "article bees"
  270 + And I fill in "search-input" with "bees and"
299 271 And I press "Search"
300 272 Then I should see "bees and butterflies" within "#search-results"
301   -
302   - Scenario: filter contents by facet
303   - Given the following categories
304   - | name | parent |
305   - | Software Livre | tematicas |
306   - | Big Brother | tematicas |
307   - And the following articles
308   - | owner | name | body | category |
309   - | joaosilva | noosfero and debian | this is an article about noosfero and debian | software-livre |
310   - | joaosilva | facebook and 1984 | this is an article about facebook and 1984 | big-brother |
311   - When I go to the search articles page
312   - And I fill in "search-input" with "this is an article"
313   - And I press "Search"
314   - # Then show me the page
315   - And I follow "Software Livre" within "#facets-menu"
316   - Then I should see "noosfero and debian" within "#search-results"
317   - And I should not see "facebook and 1984"
318   - # facet should also be de-selectable
319   - When I follow "remove facet" within ".facet-selected"
320   - Then I should see "facebook and 1984"
321   -
322   - Scenario: remember facet filter when searching new query
323   - Given the following category
324   - | name | parent |
325   - | Software Livre | tematicas |
326   - And the following articles
327   - | owner | name | body | category |
328   - | joaosilva | noosfero and debian | this is an article about noosfero and debian | software-livre |
329   - | joaosilva | facebook and 1984 | this is an article about facebook and 1984 | big-brother |
330   - | joaosilva | facebook defense | facebook is not so bad | software-livre |
331   - When I go to the search articles page
332   - And I fill in "search-input" with "this is an article"
333   - And I press "Search"
334   - And I follow "Software Livre" within "#facets-menu"
335   - And I fill in "search-input" with "facebook"
336   - And I press "Search"
337   - Then I should see "facebook defense" within "#search-results"
338   - And I should not see "1984"
... ...
features/search_enterprises.feature
... ... @@ -4,14 +4,10 @@ Feature: search enterprises
4 4 In order to find ones that interest me
5 5  
6 6 Background:
7   - Given the search index is empty
8 7 And the following enterprises
9 8 | identifier | name | img |
10 9 | shop1 | Shoes shop | shoes |
11 10 | shop2 | Fruits shop | fruits |
12   - And the following categories as facets
13   - | name |
14   - | Temáticas |
15 11  
16 12 Scenario: show recent enterprises on index
17 13 Given there are no pending jobs
... ... @@ -44,6 +40,7 @@ Feature: search enterprises
44 40 | owner | name | body | homepage |
45 41 | shop1 | Shoes home | This is the <i>homepage</i> of Shoes shop! It has a very long and pretty vague description, just so we can test wether the system will correctly create an excerpt of this text. We should probably talk about shoes. | true |
46 42 When I search enterprises for "shoes"
  43 + And I follow "Full"
47 44 Then I should see "This is the homepage of" within ".search-enterprise-description"
48 45 And I should see "about sho..." within ".search-enterprise-description"
49 46  
... ... @@ -52,114 +49,15 @@ Feature: search enterprises
52 49 | identifier | name | description |
53 50 | shop3 | Clothes shop | This <b>clothes</b> shop also sells shoes! This too has a very long and pretty vague description, just so we can test wether the system will correctly create an excerpt of this text. Clothes are a really important part of our lives. |
54 51 When I search enterprises for "clothes"
  52 + And I follow "Full"
55 53 And I should see "This clothes shop" within ".search-enterprise-description"
56 54 And I should see "really import..." within ".search-enterprise-description"
57 55  
58   - Scenario: see default facets when searching
59   - When I go to the search enterprises page
60   - And I fill in "search-input" with "shoes"
61   - And I press "Search"
62   - Then I should see "City" within "#facets-menu"
63   -
64   - Scenario: see category facets when searching
65   - When I go to the search enterprises page
66   - And I fill in "search-input" with "shoes"
67   - And I press "Search"
68   - Then I should see "Temáticas" within "#facets-menu"
69   -
70   - Scenario: see region on facets and results
71   - Given the following cities
72   - | name | state |
73   - | Pres. Prudente | SP |
74   - And the following enterprises
75   - | identifier | name | region |
76   - | art-pp | Artesanato PP | Pres. Prudente |
77   - When I go to the search enterprises page
78   - And I fill in "search-input" with "Artesanato"
79   - And I press "Search"
80   - Then I should see "Pres. Prudente" within "#facet-menu-f_region"
81   - And I should see ", SP" within "#facet-menu-f_region"
82   - And I should see "City" within ".search-enterprise-region-label"
83   - And I should see "Pres. Prudente, SP" within ".search-enterprise-region-name"
84   -
85   - Scenario: find enterprise by region
86   - Given the following cities
87   - | name | state |
88   - | Pres. Prudente | SP |
89   - And the following enterprises
90   - | identifier | name | region |
91   - | art-pp | Artesanato PP | Pres. Prudente |
92   - When I go to the search enterprises page
93   - And I fill in "search-input" with "Prudente"
94   - And I press "Search"
95   - Then I should see "Artesanato PP" within "#search-results"
96   -
97   - Scenario: find enterprise by category
98   - Given the following categories
99   - | name |
100   - | Software Livre |
101   - And the following enterprises
102   - | identifier | name | category |
103   - | noosfero | Noosfero | software-livre |
104   - When I go to the search enterprises page
105   - And I fill in "search-input" with "software"
106   - And I press "Search"
107   - Then I should see "Noosfero" within "#search-results"
108   - And I should see "Software Livre" within ".search-enterprise-category"
109   -
110   - Scenario: show category hierarchy on search results
111   - Given the following categories
112   - | name | parent |
113   - | Software Livre | |
114   - | Rails | software-livre |
115   - And the following enterprises
116   - | identifier | name | category |
117   - | noosfero | Noosfero | rails |
118   - When I search enterprises for "Rails"
119   - Then I should see "Software Livre" within ".search-enterprise-category"
120   - And I should see "Rails" within ".search-enterprise-category"
121   -
122 56 Scenario: find enterprises without exact query
123 57 Given the following enterprises
124 58 | identifier | name |
125 59 | noosfero | Noosfero Developers Association |
126 60 When I go to the search enterprises page
127   - And I fill in "search-input" with "Noosfero Association"
  61 + And I fill in "search-input" with "Noosfero Developers"
128 62 And I press "Search"
129 63 Then I should see "Noosfero Developers Association" within "#search-results"
130   -
131   - Scenario: filter enterprises by facet
132   - Given the following category
133   - | name | parent |
134   - | Software Livre | tematicas |
135   - And the following enterprises
136   - | identifier | name | category |
137   - | noosfero | Noosfero Developers | software-livre |
138   - | facebook | Facebook Developers | |
139   - When I go to the search enterprises page
140   - And I fill in "search-input" with "Developers"
141   - And I press "Search"
142   - And I follow "Software Livre" within "#facets-menu"
143   - Then I should see "Noosfero Developers" within "#search-results"
144   - And I should not see "Facebook Developers"
145   - # facet should also be de-selectable
146   - When I follow "remove facet" within ".facet-selected"
147   - Then I should see "Facebook Developers"
148   -
149   - Scenario: remember facet filter when searching new query
150   - Given the following category
151   - | name | parent |
152   - | Software Livre | tematicas |
153   - And the following enterprises
154   - | identifier | name | category |
155   - | noosfero | Noosfero Developers | software-livre |
156   - | rails-dev | Rails Developers | |
157   - | rails-usr | Rails Users | software-livre |
158   - When I go to the search enterprises page
159   - And I fill in "search-input" with "Developers"
160   - And I press "Search"
161   - And I follow "Software Livre" within "#facets-menu"
162   - And I fill in "search-input" with "Rails"
163   - And I press "Search"
164   - Then I should see "Rails Users" within "#search-results"
165   - And I should not see "Rails Developers"
... ...
features/search_people.feature
... ... @@ -4,8 +4,7 @@ Feature: search people
4 4 In order to find ones that interest me
5 5  
6 6 Background:
7   - Given the search index is empty
8   - And the following users
  7 + Given the following users
9 8 | login | name |
10 9 | joaosilva | Joao Silva |
11 10 | josearaujo | Jose Araujo |
... ... @@ -27,76 +26,11 @@ Feature: search people
27 26 When I search people for "something unrelated"
28 27 Then I should see "None" within ".search-results-type-empty"
29 28  
30   - Scenario: see category facets when searching
31   - Given the following categories as facets
32   - | name |
33   - | Temáticas |
34   - When I go to the search people page
35   - And I fill in "search-input" with "joao"
36   - And I press "Search"
37   - Then I should see "Temáticas" within "#facets-menu"
38   -
39   - Scenario: search people by category
40   - Given the following category
41   - | name |
42   - | Software Livre |
43   - And the following users
44   - | login | name | category |
45   - | linus | Linus Torvalds | software-livre |
46   - When I go to the search people page
47   - And I fill in "search-input" with "software livre"
48   - And I press "Search"
49   - Then I should see "Linus Torvalds" within "#search-results"
50   - And I should not see "Joao Silva"
51   - And I should not see "Jose Araujo"
52   -
53 29 Scenario: find person without exact query
54 30 Given the following users
55 31 | login | name |
56 32 | jsilva | Joao Adalberto de Oliveira Silva |
57 33 When I go to the search people page
58   - And I fill in "search-input" with "Adalberto Silva"
  34 + And I fill in "search-input" with "Adalberto de Oliveira"
59 35 And I press "Search"
60 36 Then I should see "Joao Adalberto de Oliveira Silva" within "#search-results"
61   -
62   - Scenario: filter people by facet
63   - Given the following categories as facets
64   - | name |
65   - | Temáticas |
66   - And the following category
67   - | name | parent |
68   - | Software Livre | tematicas |
69   - And the following users
70   - | login | name | category |
71   - | linus | Linus Torvalds | software-livre |
72   - | other | Other Linus | |
73   - When I go to the search people page
74   - And I fill in "search-input" with "Linus"
75   - And I press "Search"
76   - And I follow "Software Livre" within "#facets-menu"
77   - Then I should see "Linus Torvalds" within "#search-results"
78   - And I should not see "Other Linus"
79   - # facet should also be de-selectable
80   - When I follow "remove facet" within ".facet-selected"
81   - Then I should see "Other Linus"
82   -
83   - Scenario: remember facet filter when searching new query
84   - Given the following categories as facets
85   - | name |
86   - | Temáticas |
87   - And the following category
88   - | name | parent |
89   - | Software Livre | tematicas |
90   - And the following users
91   - | login | name | category |
92   - | linus | Linus Torvalds | software-livre |
93   - | rilin | Richard Linus | |
94   - | stall | Richard Stallman | software-livre |
95   - When I go to the search people page
96   - And I fill in "search-input" with "Linus"
97   - And I press "Search"
98   - And I follow "Software Livre" within "#facets-menu"
99   - And I fill in "search-input" with "Richard"
100   - And I press "Search"
101   - Then I should see "Richard Stallman" within "#search-results"
102   - And I should not see "Richard Linus"
... ...
features/search_products.feature
... ... @@ -4,8 +4,7 @@ Feature: search products
4 4 In order to find ones that interest me
5 5  
6 6 Background:
7   - Given the search index is empty
8   - And feature "disable_asset_products" is disabled on environment
  7 + Given feature "disable_asset_products" is disabled on environment
9 8 And the following enterprises
10 9 | identifier | name |
11 10 | colivre-ent | Colivre |
... ... @@ -22,11 +21,6 @@ Feature: search products
22 21 Then I should see "wikis consultancy" within "#search-results"
23 22 And I should see "social networks consultancy" within "#search-results"
24 23  
25   - Scenario: not show pagination and facets on recent products
26   - When I go to the search products page
27   - Then The page should not contain "div.pagination"
28   - And The page should not contain "#facets-menu"
29   -
30 24 Scenario: show empty search results
31 25 When I search products for "something unrelated"
32 26 Then I should see "None" within ".search-results-type-empty"
... ... @@ -40,14 +34,6 @@ Feature: search products
40 34 And I should not see "social networks consultancy"
41 35 And I should not see social networks consultancy's product image
42 36  
43   - Scenario: see default facets when searching
44   - When I go to the search products page
45   - And I fill in "search-input" with "wikis"
46   - And I press "Search"
47   - Then I should see "Related products" within "#facets-menu"
48   - Then I should see "City" within "#facets-menu"
49   - Then I should see "Qualifiers" within "#facets-menu"
50   -
51 37 Scenario: show percentage (100%) of solidary economy inputs in results
52 38 Given the following inputs
53 39 | product | category | solidary |
... ... @@ -101,58 +87,6 @@ Feature: search products
101 87 Then I should not see "No image"
102 88 And I should see "Zoom in" within "a.zoomify-image"
103 89  
104   - Scenario: search products by category
105   - Given the following product_category
106   - | name |
107   - | Software Livre |
108   - And the following product
109   - | owner | name | category |
110   - | colivre-ent | Noosfero | software-livre |
111   - When I go to the search products page
112   - And I fill in "search-input" with "software livre"
113   - And I press "Search"
114   - Then I should see "Noosfero" within "#search-results"
115   - And I should not see "wikis consultancy"
116   - And I should not see "social networks consultancy"
117   -
118   - Scenario: see region on facets and results
119   - Given the following cities
120   - | name | state |
121   - | Pres. Prudente | SP |
122   - And the following enterprise
123   - | identifier | name | region |
124   - | art-pp | Artesanato PP | Pres. Prudente |
125   - And the following product_category
126   - | name |
127   - | Solidária |
128   - And the following product
129   - | owner | name | category |
130   - | art-pp | Arte em Madeira | solidaria |
131   - When I go to the search products page
132   - And I fill in "search-input" with "Madeira"
133   - And I press "Search"
134   - Then I should see "Pres. Prudente" within "#facet-menu-f_region"
135   - And I should see ", SP" within "#facet-menu-f_region"
136   - And I should see "Pres. Prudente, SP" within "#search-results"
137   -
138   - Scenario: find product by region
139   - Given the following cities
140   - | name | state |
141   - | Pres. Prudente | SP |
142   - And the following enterprise
143   - | identifier | name | region |
144   - | art-pp | Artesanato PP | Pres. Prudente |
145   - And the following product_category
146   - | name |
147   - | Solidária |
148   - And the following product
149   - | owner | name | category |
150   - | art-pp | Arte em Madeira | solidaria |
151   - When I go to the search products page
152   - And I fill in "search-input" with "Prudente"
153   - And I press "Search"
154   - Then I should see "Arte em Madeira" within "#search-results"
155   -
156 90 Scenario: find products without exact query
157 91 Given the following product_category
158 92 | name |
... ... @@ -161,63 +95,10 @@ Feature: search products
161 95 | owner | name | category |
162 96 | colivre-ent | Noosfero Social Network Platform | software-livre |
163 97 When I go to the search products page
164   - And I fill in "search-input" with "Noosfero Network"
  98 + And I fill in "search-input" with "Noosfero Social"
165 99 And I press "Search"
166 100 Then I should see "Noosfero Social Network Platform" within "#search-results"
167 101  
168   - Scenario: filter products by facet
169   - Given the following enterprises
170   - | identifier | name |
171   - | fb | FB inc. |
172   - And the following categories as facets
173   - | name |
174   - | Temáticas |
175   - And the following product_categories
176   - | name | parent |
177   - | Software Livre | tematicas |
178   - | Big Brother | tematicas |
179   - And the following products
180   - | owner | name | category |
181   - | colivre-ent | Noosfero Network | software-livre |
182   - | fb | Facebook Network | big-brother |
183   - When I go to the search products page
184   - And I fill in "search-input" with "Network"
185   - And I press "Search"
186   - And I follow "Software Livre" within "#facets-menu"
187   - Then I should see "Noosfero Network" within "#search-results"
188   - And I should not see "Facebook Network"
189   - # facet should also be de-selectable
190   - When I follow "remove facet" within ".facet-selected"
191   - Then I should see "Facebook Network"
192   -
193   - Scenario: remember facet filter when searching new query
194   - Given the following enterprises
195   - | identifier | name |
196   - | fb | FB inc. |
197   - | other | Other |
198   - And the following categories as facets
199   - | name |
200   - | Temáticas |
201   - And the following product_categories
202   - | name | parent |
203   - | Software Livre | tematicas |
204   - | Big Brother | tematicas |
205   - | Other | tematicas |
206   - And the following products
207   - | owner | name | category |
208   - | colivre-ent | Noosfero Network | software-livre |
209   - | fb | Facebook Network | big-brother |
210   - | other | Other open | software-livre |
211   - | other | Other closed | big-brother |
212   - When I go to the search products page
213   - And I fill in "search-input" with "Network"
214   - And I press "Search"
215   - And I follow "Software Livre" within "#facets-menu"
216   - And I fill in "search-input" with "Other"
217   - And I press "Search"
218   - Then I should see "Other open" within "#search-results"
219   - And I should not see "Other closed"
220   -
221 102 Scenario: don't search when products are disabled in environment
222 103 Given feature "disable_asset_products" is enabled on environment
223 104 When I go to the search products page
... ...
features/step_definitions/noosfero_steps.rb
... ... @@ -615,25 +615,6 @@ Given /^([^\s]+) (enabled|disabled) translation redirection in (?:his|her) profi
615 615 profile.save
616 616 end
617 617  
618   -Given /^the search index is empty$/ do
619   - ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => '*:*'))
620   -end
621   -
622   -# This could be merged with "the following categories"
623   -Given /^the following categories as facets$/ do |table|
624   - ids = []
625   - table.hashes.each do |item|
626   - cat = Category.find_by_name(item[:name])
627   - if cat.nil?
628   - cat = Category.create!(:environment_id => Environment.default.id, :name => item[:name])
629   - end
630   - ids << cat.id
631   - end
632   - env = Environment.default
633   - env.top_level_category_as_facet_ids = ids
634   - env.save!
635   -end
636   -
637 618 Given /^the following cities$/ do |table|
638 619 table.hashes.each do |item|
639 620 state = State.find_by_acronym item[:state]
... ...
plugins/solr/features/.search_products.feature.swp 0 → 100644
No preview for this file type
plugins/solr/features/search_communities.feature 0 → 100644
... ... @@ -0,0 +1,93 @@
  1 +Feature: search
  2 + As a noosfero user
  3 + I want to search
  4 + In order to find stuff
  5 +
  6 + Background:
  7 + Given the search index is empty
  8 + And the following category
  9 + | name |
  10 + | social network |
  11 + And the following community
  12 + | identifier | name | category | img |
  13 + | noosfero | Noosfero Community | social-network | noosfero-network |
  14 +
  15 + Scenario: search communities by category
  16 + Given the following category
  17 + | name |
  18 + | Software Livre |
  19 + And the following community
  20 + | identifier | name | category |
  21 + | noos-comm | Noosfero Community | software-livre |
  22 + When I go to the search communities page
  23 + And I fill in "search-input" with "software livre"
  24 + And I press "Search"
  25 + Then I should see "Noosfero" within "#search-results"
  26 +
  27 + Scenario: see category facets when searching
  28 + Given the following categories as facets
  29 + | name |
  30 + | Temáticas |
  31 + And the following category
  32 + | name | parent |
  33 + | Software Livre | tematicas |
  34 + And the following community
  35 + | identifier | name | category |
  36 + | linux | Linux Community | software-livre |
  37 + When I go to the search communities page
  38 + And I fill in "search-input" with "Linux"
  39 + And I press "Search"
  40 + Then I should see "Temáticas" within "#facets-menu"
  41 +
  42 + Scenario: find communities without exact query
  43 + Given the following communities
  44 + | identifier | name |
  45 + | luwac | Linux Users Without a Clue |
  46 + When I go to the search communities page
  47 + And I fill in "search-input" with "Linux Clue"
  48 + And I press "Search"
  49 + Then I should see "Linux Users Without a Clue" within "#search-results"
  50 +
  51 + Scenario: filter communities by facet
  52 + Given the following categories as facets
  53 + | name |
  54 + | Temáticas |
  55 + And the following category
  56 + | name | parent |
  57 + | Software Livre | tematicas |
  58 + | Big Brother | tematicas |
  59 + And the following communities
  60 + | identifier | name | category |
  61 + | noos-dev | Noosfero Developers | software-livre |
  62 + | facebook | Facebook Developers | big-brother |
  63 + When I go to the search communities page
  64 + And I fill in "search-input" with "Developers"
  65 + And I press "Search"
  66 + And I follow "Software Livre" within "#facets-menu"
  67 + Then I should see "Noosfero Developers" within "#search-results"
  68 + And I should not see "Facebook Developers"
  69 + # facet should also be de-selectable
  70 + When I follow "remove facet" within ".facet-selected"
  71 + Then I should see "Facebook Developers"
  72 +
  73 + Scenario: remember facet filter when searching new query
  74 + Given the following categories as facets
  75 + | name |
  76 + | Temáticas |
  77 + And the following category
  78 + | name | parent |
  79 + | Software Livre | tematicas |
  80 + | Other Category | tematicas |
  81 + And the following communities
  82 + | identifier | name | category |
  83 + | noos-dev | Noosfero Developers | software-livre |
  84 + | rails-dev | Rails Developers | other-category |
  85 + | rails-usr | Rails Users | software-livre |
  86 + When I go to the search communities page
  87 + And I fill in "search-input" with "Developers"
  88 + And I press "Search"
  89 + And I follow "Software Livre" within "#facets-menu"
  90 + And I fill in "search-input" with "Rails"
  91 + And I press "Search"
  92 + Then I should see "Rails Users" within "#search-results"
  93 + And I should not see "Rails Developers"
... ...
plugins/solr/features/search_contents.feature 0 → 100644
... ... @@ -0,0 +1,84 @@
  1 +Feature: search contents
  2 + As a noosfero user
  3 + I want to search contents
  4 + In order to find ones that interest me
  5 +
  6 + Background:
  7 + Given the search index is empty
  8 + And the following users
  9 + Given the following users
  10 + | login | name |
  11 + | joaosilva | Joao Silva |
  12 + And the following articles
  13 + | owner | name | body |
  14 + | joaosilva | bees and butterflies | this is an article about bees and butterflies |
  15 + | joaosilva | whales and dolphins | this is an article about whales and dolphins |
  16 + And the following categories as facets
  17 + | name |
  18 + | Temáticas |
  19 +
  20 + Scenario: search articles by category
  21 + Given the following category
  22 + | name |
  23 + | Software Livre |
  24 + And the following articles
  25 + | owner | name | body | category |
  26 + | joaosilva | using noosfero | noosfero is a great CMS | software-livre |
  27 + When I go to the search articles page
  28 + And I fill in "search-input" with "Software"
  29 + And I press "Search"
  30 + Then I should see "using noosfero" within "#search-results"
  31 + And I should not see "bees and butterflies"
  32 + And I should not see "whales and dolphins"
  33 +
  34 + Scenario: see default facets when searching
  35 + When I go to the search articles page
  36 + And I fill in "search-input" with "bees"
  37 + And I press "Search"
  38 + Then I should see "Type" within "#facets-menu"
  39 + And I should see "Published date" within "#facets-menu"
  40 + And I should see "Profile" within "#facets-menu"
  41 + And I should see "Categories" within "#facets-menu"
  42 +
  43 + Scenario: find enterprises without exact query
  44 + When I go to the search articles page
  45 + And I fill in "search-input" with "bees and"
  46 + And I press "Search"
  47 + Then I should see "bees and butterflies" within "#search-results"
  48 +
  49 + Scenario: filter contents by facet
  50 + Given the following categories
  51 + | name | parent |
  52 + | Software Livre | tematicas |
  53 + | Big Brother | tematicas |
  54 + And the following articles
  55 + | owner | name | body | category |
  56 + | joaosilva | noosfero and debian | this is an article about noosfero and debian | software-livre |
  57 + | joaosilva | facebook and 1984 | this is an article about facebook and 1984 | big-brother |
  58 + When I go to the search articles page
  59 + And I fill in "search-input" with "this is an article"
  60 + And I press "Search"
  61 + And I follow "Software Livre" within "#facets-menu"
  62 + Then I should see "noosfero and debian" within "#search-results"
  63 + And I should not see "facebook and 1984"
  64 + # facet should also be de-selectable
  65 + When I follow "remove facet" within ".facet-selected"
  66 + Then I should see "facebook and 1984"
  67 +
  68 + Scenario: remember facet filter when searching new query
  69 + Given the following category
  70 + | name | parent |
  71 + | Software Livre | tematicas |
  72 + And the following articles
  73 + | owner | name | body | category |
  74 + | joaosilva | noosfero and debian | this is an article about noosfero and debian | software-livre |
  75 + | joaosilva | facebook and 1984 | this is an article about facebook and 1984 | big-brother |
  76 + | joaosilva | facebook defense | facebook is not so bad | software-livre |
  77 + When I go to the search articles page
  78 + And I fill in "search-input" with "this is an article"
  79 + And I press "Search"
  80 + And I follow "Software Livre" within "#facets-menu"
  81 + And I fill in "search-input" with "facebook"
  82 + And I press "Search"
  83 + Then I should see "facebook defense" within "#search-results"
  84 + And I should not see "1984"
... ...
plugins/solr/features/search_enterprises.feature 0 → 100644
... ... @@ -0,0 +1,122 @@
  1 +Feature: search enterprises
  2 + As a noosfero user
  3 + I want to search enterprises
  4 + In order to find ones that interest me
  5 +
  6 + Background:
  7 + Given the search index is empty
  8 + And the following enterprises
  9 + | identifier | name | img |
  10 + | shop1 | Shoes shop | shoes |
  11 + | shop2 | Fruits shop | fruits |
  12 + And the following categories as facets
  13 + | name |
  14 + | Temáticas |
  15 + Scenario: see default facets when searching
  16 + When I go to the search enterprises page
  17 + And I fill in "search-input" with "shoes"
  18 + And I press "Search"
  19 + Then I should see "City" within "#facets-menu"
  20 +
  21 + Scenario: see category facets when searching
  22 + When I go to the search enterprises page
  23 + And I fill in "search-input" with "shoes"
  24 + And I press "Search"
  25 + Then I should see "Temáticas" within "#facets-menu"
  26 +
  27 + Scenario: see region on facets and results
  28 + Given the following cities
  29 + | name | state |
  30 + | Pres. Prudente | SP |
  31 + And the following enterprises
  32 + | identifier | name | region |
  33 + | art-pp | Artesanato PP | Pres. Prudente |
  34 + When I go to the search enterprises page
  35 + And I fill in "search-input" with "Artesanato"
  36 + And I press "Search"
  37 + Then I should see "Pres. Prudente" within "#facet-menu-f_region"
  38 + And I should see ", SP" within "#facet-menu-f_region"
  39 + And I should see "City" within ".search-enterprise-region-label"
  40 + And I should see "Pres. Prudente, SP" within ".search-enterprise-region-name"
  41 +
  42 + Scenario: find enterprise by region
  43 + Given the following cities
  44 + | name | state |
  45 + | Pres. Prudente | SP |
  46 + And the following enterprises
  47 + | identifier | name | region |
  48 + | art-pp | Artesanato PP | Pres. Prudente |
  49 + When I go to the search enterprises page
  50 + And I fill in "search-input" with "Prudente"
  51 + And I press "Search"
  52 + Then I should see "Artesanato PP" within "#search-results"
  53 +
  54 + Scenario: find enterprise by category
  55 + Given the following categories
  56 + | name |
  57 + | Software Livre |
  58 + And the following enterprises
  59 + | identifier | name | category |
  60 + | noosfero | Noosfero | software-livre |
  61 + When I go to the search enterprises page
  62 + And I fill in "search-input" with "software"
  63 + And I press "Search"
  64 + Then I should see "Noosfero" within "#search-results"
  65 + And I should see "Software Livre" within ".search-enterprise-category"
  66 +
  67 + Scenario: show category hierarchy on search results
  68 + Given the following categories
  69 + | name | parent |
  70 + | Software Livre | |
  71 + | Rails | software-livre |
  72 + And the following enterprises
  73 + | identifier | name | category |
  74 + | noosfero | Noosfero | rails |
  75 + When I search enterprises for "Rails"
  76 + Then I should see "Software Livre" within ".search-enterprise-category"
  77 + And I should see "Rails" within ".search-enterprise-category"
  78 +
  79 + Scenario: find enterprises without exact query
  80 + Given the following enterprises
  81 + | identifier | name |
  82 + | noosfero | Noosfero Developers Association |
  83 + When I go to the search enterprises page
  84 + And I fill in "search-input" with "Noosfero Association"
  85 + And I press "Search"
  86 + Then I should see "Noosfero Developers Association" within "#search-results"
  87 +
  88 + Scenario: filter enterprises by facet
  89 + Given the following category
  90 + | name | parent |
  91 + | Software Livre | tematicas |
  92 + And the following enterprises
  93 + | identifier | name | category |
  94 + | noosfero | Noosfero Developers | software-livre |
  95 + | facebook | Facebook Developers | |
  96 + When I go to the search enterprises page
  97 + And I fill in "search-input" with "Developers"
  98 + And I press "Search"
  99 + And I follow "Software Livre" within "#facets-menu"
  100 + Then I should see "Noosfero Developers" within "#search-results"
  101 + And I should not see "Facebook Developers"
  102 + # facet should also be de-selectable
  103 + When I follow "remove facet" within ".facet-selected"
  104 + Then I should see "Facebook Developers"
  105 +
  106 + Scenario: remember facet filter when searching new query
  107 + Given the following category
  108 + | name | parent |
  109 + | Software Livre | tematicas |
  110 + And the following enterprises
  111 + | identifier | name | category |
  112 + | noosfero | Noosfero Developers | software-livre |
  113 + | rails-dev | Rails Developers | |
  114 + | rails-usr | Rails Users | software-livre |
  115 + When I go to the search enterprises page
  116 + And I fill in "search-input" with "Developers"
  117 + And I press "Search"
  118 + And I follow "Software Livre" within "#facets-menu"
  119 + And I fill in "search-input" with "Rails"
  120 + And I press "Search"
  121 + Then I should see "Rails Users" within "#search-results"
  122 + And I should not see "Rails Developers"
... ...
plugins/solr/features/search_people.feature 0 → 100644
... ... @@ -0,0 +1,85 @@
  1 +Feature: search people
  2 + As a noosfero user
  3 + I want to search people
  4 + In order to find ones that interest me
  5 +
  6 + Background:
  7 + Given the search index is empty
  8 + And the following users
  9 + | login | name |
  10 + | joaosilva | Joao Silva |
  11 + | josearaujo | Jose Araujo |
  12 +
  13 + Scenario: see category facets when searching
  14 + Given the following categories as facets
  15 + | name |
  16 + | Temáticas |
  17 + When I go to the search people page
  18 + And I fill in "search-input" with "joao"
  19 + And I press "Search"
  20 + Then I should see "Temáticas" within "#facets-menu"
  21 +
  22 + Scenario: search people by category
  23 + Given the following category
  24 + | name |
  25 + | Software Livre |
  26 + And the following users
  27 + | login | name | category |
  28 + | linus | Linus Torvalds | software-livre |
  29 + When I go to the search people page
  30 + And I fill in "search-input" with "software livre"
  31 + And I press "Search"
  32 + Then I should see "Linus Torvalds" within "#search-results"
  33 + And I should not see "Joao Silva"
  34 + And I should not see "Jose Araujo"
  35 +
  36 + Scenario: find person without exact query
  37 + Given the following users
  38 + | login | name |
  39 + | jsilva | Joao Adalberto de Oliveira Silva |
  40 + When I go to the search people page
  41 + And I fill in "search-input" with "Adalberto Silva"
  42 + And I press "Search"
  43 + Then I should see "Joao Adalberto de Oliveira Silva" within "#search-results"
  44 +
  45 + Given the following categories as facets
  46 + | name |
  47 + | Temáticas |
  48 + And the following category
  49 + | name | parent |
  50 + | Software Livre | tematicas |
  51 + And the following users
  52 + | login | name | category |
  53 + | linus | Linus Torvalds | software-livre |
  54 + | other | Other Linus | |
  55 + When I go to the search people page
  56 + And I fill in "search-input" with "Linus"
  57 + And I press "Search"
  58 + And I follow "Software Livre" within "#facets-menu"
  59 + Then I should see "Linus Torvalds" within "#search-results"
  60 + And I should not see "Other Linus"
  61 + # facet should also be de-selectable
  62 + When I follow "remove facet" within ".facet-selected"
  63 + Then I should see "Other Linus"
  64 +
  65 + Scenario: remember facet filter when searching new query
  66 + Given the following categories as facets
  67 + | name |
  68 + | Temáticas |
  69 + And the following category
  70 + | name | parent |
  71 + | Software Livre | tematicas |
  72 + And the following users
  73 + | login | name | category |
  74 + | linus | Linus Torvalds | software-livre |
  75 + | rilin | Richard Linus | |
  76 + | stall | Richard Stallman | software-livre |
  77 + When I go to the search people page
  78 + And I fill in "search-input" with "Linus"
  79 + And I press "Search"
  80 + And I follow "Software Livre" within "#facets-menu"
  81 + And I fill in "search-input" with "Richard"
  82 + And I press "Search"
  83 + Then I should see "Richard Stallman" within "#search-results"
  84 + And I should not see "Richard Linus"
  85 +
... ...
plugins/solr/features/search_products.feature 0 → 100644
... ... @@ -0,0 +1,149 @@
  1 +Feature: search products
  2 + As a noosfero user
  3 + I want to search products
  4 + In order to find ones that interest me
  5 +
  6 + Background:
  7 + Given the search index is empty
  8 + And feature "disable_asset_products" is disabled on environment
  9 + And the following enterprises
  10 + | identifier | name |
  11 + | colivre-ent | Colivre |
  12 + And the following product_categories
  13 + | name |
  14 + | Development |
  15 + And the following products
  16 + | owner | category | name | price | img |
  17 + | colivre-ent | development | social networks consultancy | 1.00 | fruits |
  18 + | colivre-ent | development | wikis consultancy | 2.00 | shoes |
  19 +
  20 + Scenario: not show pagination and facets on recent products
  21 + When I go to the search products page
  22 + Then The page should not contain "div.pagination"
  23 + And The page should not contain "#facets-menu"
  24 +
  25 + Scenario: see default facets when searching
  26 + When I go to the search products page
  27 + And I fill in "search-input" with "wikis"
  28 + And I press "Search"
  29 + Then I should see "Related products" within "#facets-menu"
  30 + Then I should see "City" within "#facets-menu"
  31 + Then I should see "Qualifiers" within "#facets-menu"
  32 +
  33 + Scenario: search products by category
  34 + Given the following product_category
  35 + | name |
  36 + | Software Livre |
  37 + And the following product
  38 + | owner | name | category |
  39 + | colivre-ent | Noosfero | software-livre |
  40 + When I go to the search products page
  41 + And I fill in "search-input" with "software livre"
  42 + And I press "Search"
  43 + Then I should see "Noosfero" within "#search-results"
  44 + And I should not see "wikis consultancy"
  45 + And I should not see "social networks consultancy"
  46 +
  47 + Scenario: see region on facets and results
  48 + Given the following cities
  49 + | name | state |
  50 + | Pres. Prudente | SP |
  51 + And the following enterprise
  52 + | identifier | name | region |
  53 + | art-pp | Artesanato PP | Pres. Prudente |
  54 + And the following product_category
  55 + | name |
  56 + | Solidária |
  57 + And the following product
  58 + | owner | name | category |
  59 + | art-pp | Arte em Madeira | solidaria |
  60 + When I go to the search products page
  61 + And I fill in "search-input" with "Madeira"
  62 + And I press "Search"
  63 + Then I should see "Pres. Prudente" within "#facet-menu-f_region"
  64 + And I should see ", SP" within "#facet-menu-f_region"
  65 + And I should see "Pres. Prudente, SP" within "#search-results"
  66 +
  67 + Scenario: find product by region
  68 + Given the following cities
  69 + | name | state |
  70 + | Pres. Prudente | SP |
  71 + And the following enterprise
  72 + | identifier | name | region |
  73 + | art-pp | Artesanato PP | Pres. Prudente |
  74 + And the following product_category
  75 + | name |
  76 + | Solidária |
  77 + And the following product
  78 + | owner | name | category |
  79 + | art-pp | Arte em Madeira | solidaria |
  80 + When I go to the search products page
  81 + And I fill in "search-input" with "Prudente"
  82 + And I press "Search"
  83 + Then I should see "Arte em Madeira" within "#search-results"
  84 +
  85 + Scenario: find products without exact query
  86 + Given the following product_category
  87 + | name |
  88 + | Software Livre |
  89 + And the following products
  90 + | owner | name | category |
  91 + | colivre-ent | Noosfero Social Network Platform | software-livre |
  92 + When I go to the search products page
  93 + And I fill in "search-input" with "Noosfero Network"
  94 + And I press "Search"
  95 + Then I should see "Noosfero Social Network Platform" within "#search-results"
  96 +
  97 + Scenario: filter products by facet
  98 + Given the following enterprises
  99 + | identifier | name |
  100 + | fb | FB inc. |
  101 + And the following categories as facets
  102 + | name |
  103 + | Temáticas |
  104 + And the following product_categories
  105 + | name | parent |
  106 + | Software Livre | tematicas |
  107 + | Big Brother | tematicas |
  108 + And the following products
  109 + | owner | name | category |
  110 + | colivre-ent | Noosfero Network | software-livre |
  111 + | fb | Facebook Network | big-brother |
  112 + When I go to the search products page
  113 + And I fill in "search-input" with "Network"
  114 + And I press "Search"
  115 + And I follow "Software Livre" within "#facets-menu"
  116 + Then I should see "Noosfero Network" within "#search-results"
  117 + And I should not see "Facebook Network"
  118 + # facet should also be de-selectable
  119 + When I follow "remove facet" within ".facet-selected"
  120 + Then I should see "Facebook Network"
  121 +
  122 + Scenario: remember facet filter when searching new query
  123 + Given the following enterprises
  124 + | identifier | name |
  125 + | fb | FB inc. |
  126 + | other | Other |
  127 + And the following categories as facets
  128 + | name |
  129 + | Temáticas |
  130 + And the following product_categories
  131 + | name | parent |
  132 + | Software Livre | tematicas |
  133 + | Big Brother | tematicas |
  134 + | Other | tematicas |
  135 + And the following products
  136 + | owner | name | category |
  137 + | colivre-ent | Noosfero Network | software-livre |
  138 + | fb | Facebook Network | big-brother |
  139 + | other | Other open | software-livre |
  140 + | other | Other closed | big-brother |
  141 + When I go to the search products page
  142 + And I fill in "search-input" with "Network"
  143 + And I press "Search"
  144 + And I follow "Software Livre" within "#facets-menu"
  145 + And I fill in "search-input" with "Other"
  146 + And I press "Search"
  147 + Then I should see "Other open" within "#search-results"
  148 + And I should not see "Other closed"
  149 +
... ...
plugins/solr/features/steps/solr_steps.rb 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +Given /^the search index is empty$/ do
  2 + ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => '*:*'))
  3 +end
  4 +
  5 +# This could be merged with "the following categories"
  6 +Given /^the following categories as facets$/ do |table|
  7 + ids = []
  8 + table.hashes.each do |item|
  9 + cat = Category.find_by_name(item[:name])
  10 + if cat.nil?
  11 + cat = Category.create!(:environment_id => Environment.default.id, :name => item[:name])
  12 + end
  13 + ids << cat.id
  14 + end
  15 + env = Environment.default
  16 + env.top_level_category_as_facet_ids = ids
  17 + env.save!
  18 +end
... ...