diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index 5b856bd..aae6ff2 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -105,7 +105,7 @@ class SearchController < PublicController environment.events.by_day(@selected_day) end - @scope = date_range ? environment.events.by_range(date_range) : environment.events + @scope = date_range && params[:action] == :events ? environment.events.by_range(date_range) : environment.events full_text_search events = @searches[@asset][:results] diff --git a/app/views/search/events.html.erb b/app/views/search/events.html.erb index 0785346..ad01a31 100644 --- a/app/views/search/events.html.erb +++ b/app/views/search/events.html.erb @@ -1 +1,2 @@ +<%= search_page_title( Environment.default.name + "'s " + _('Events'), @category ) %> <%= render :partial => 'events/agenda' %> diff --git a/features/browse.feature b/features/browse.feature index 7a4b8b0..87b5707 100644 --- a/features/browse.feature +++ b/features/browse.feature @@ -4,7 +4,6 @@ Feature: browse Background: Given I am on the homepage - And the search index is empty And the following users | login | name | | joaosilva | Joao Silva | diff --git a/features/profile_search.feature b/features/profile_search.feature index 33b4129..7191149 100644 --- a/features/profile_search.feature +++ b/features/profile_search.feature @@ -4,8 +4,7 @@ Feature: search inside a profile In order to find stuff from a profile Background: - Given the search index is empty - And the following users + Given the following users | login | name | | joaosilva | Joao Silva | And the following articles diff --git a/features/register_enterprise.feature b/features/register_enterprise.feature index fe5e380..2f02d90 100644 --- a/features/register_enterprise.feature +++ b/features/register_enterprise.feature @@ -201,10 +201,6 @@ Feature: register enterprise When I follow "Manage my groups" Then I should not see "My Enterprise" - Scenario: a user can see button to register new enterprise - When I am on /assets/enterprises - Then I should see "New enterprise" link - Scenario: a user cant see button to register new enterprise if enterprise_registration disabled Given feature "enterprise_registration" is disabled on environment When I am on /assets/enterprises diff --git a/features/search.feature b/features/search.feature index 493733d..2dc9060 100644 --- a/features/search.feature +++ b/features/search.feature @@ -4,8 +4,7 @@ Feature: search In order to find stuff Background: - Given the search index is empty - And feature "disable_asset_products" is disabled on environment + Given feature "disable_asset_products" is disabled on environment Scenario: show empty results in all enabled assets Given I go to the search page diff --git a/features/search_communities.feature b/features/search_communities.feature index 3496840..1467f77 100644 --- a/features/search_communities.feature +++ b/features/search_communities.feature @@ -4,8 +4,7 @@ Feature: search communities In order to find ones that interest me Background: - Given the search index is empty - And the following category + Given the following category | name | | social network | And the following community @@ -34,82 +33,11 @@ Feature: search communities And I should see "Noosfero Community" within ".only-one-result-box" And I should see Noosfero Community's community image - Scenario: search communities by category - Given the following category - | name | - | Software Livre | - And the following community - | identifier | name | category | - | noos-comm | Noosfero Community | software-livre | - When I go to the search communities page - And I fill in "search-input" with "software livre" - And I press "Search" - Then I should see "Noosfero" within "#search-results" - - Scenario: see category facets when searching - Given the following categories as facets - | name | - | Temáticas | - And the following category - | name | parent | - | Software Livre | tematicas | - And the following community - | identifier | name | category | - | linux | Linux Community | software-livre | - When I go to the search communities page - And I fill in "search-input" with "Linux" - And I press "Search" - Then I should see "Temáticas" within "#facets-menu" - Scenario: find communities without exact query Given the following communities | identifier | name | | luwac | Linux Users Without a Clue | When I go to the search communities page - And I fill in "search-input" with "Linux Clue" + And I fill in "search-input" with "Linux Users" And I press "Search" Then I should see "Linux Users Without a Clue" within "#search-results" - - Scenario: filter communities by facet - Given the following categories as facets - | name | - | Temáticas | - And the following category - | name | parent | - | Software Livre | tematicas | - | Big Brother | tematicas | - And the following communities - | identifier | name | category | - | noos-dev | Noosfero Developers | software-livre | - | facebook | Facebook Developers | big-brother | - When I go to the search communities page - And I fill in "search-input" with "Developers" - And I press "Search" - And I follow "Software Livre" within "#facets-menu" - Then I should see "Noosfero Developers" within "#search-results" - And I should not see "Facebook Developers" - # facet should also be de-selectable - When I follow "remove facet" within ".facet-selected" - Then I should see "Facebook Developers" - - Scenario: remember facet filter when searching new query - Given the following categories as facets - | name | - | Temáticas | - And the following category - | name | parent | - | Software Livre | tematicas | - | Other Category | tematicas | - And the following communities - | identifier | name | category | - | noos-dev | Noosfero Developers | software-livre | - | rails-dev | Rails Developers | other-category | - | rails-usr | Rails Users | software-livre | - When I go to the search communities page - And I fill in "search-input" with "Developers" - And I press "Search" - And I follow "Software Livre" within "#facets-menu" - And I fill in "search-input" with "Rails" - And I press "Search" - Then I should see "Rails Users" within "#search-results" - And I should not see "Rails Developers" diff --git a/features/search_contents.feature b/features/search_contents.feature index 7f5491c..986008c 100644 --- a/features/search_contents.feature +++ b/features/search_contents.feature @@ -4,17 +4,13 @@ Feature: search contents In order to find ones that interest me Background: - Given the search index is empty - And the following users + Given the following users | login | name | | joaosilva | Joao Silva | And the following articles | owner | name | body | | joaosilva | bees and butterflies | this is an article about bees and butterflies | | joaosilva | whales and dolphins | this is an article about whales and dolphins | - And the following categories as facets - | name | - | Temáticas | Scenario: show recent content on index When I go to the search articles page @@ -232,23 +228,8 @@ Feature: search contents | sglaspell | Susan Glaspell | And the article "whales and dolphins" is updated by "Susan Glaspell" When I search contents for "whales" - # Then show me the page Then I should see "by Susan Glaspell at" within ".search-article-author-changes" - Scenario: search articles by category - Given the following category - | name | - | Software Livre | - And the following articles - | owner | name | body | category | - | joaosilva | using noosfero | noosfero is a great CMS | software-livre | - When I go to the search articles page - And I fill in "search-input" with "Software" - And I press "Search" - Then I should see "using noosfero" within "#search-results" - And I should not see "bees and butterflies" - And I should not see "whales and dolphins" - Scenario: show basic info on blog search results Given the following blogs | owner | name | @@ -284,55 +265,8 @@ Feature: search contents When I search contents for "JSilva" Then I should see "None" within ".search-blog-items" - Scenario: see default facets when searching - When I go to the search articles page - And I fill in "search-input" with "bees" - And I press "Search" - Then I should see "Type" within "#facets-menu" - And I should see "Published date" within "#facets-menu" - And I should see "Profile" within "#facets-menu" - And I should see "Categories" within "#facets-menu" - Scenario: find enterprises without exact query When I go to the search articles page - And I fill in "search-input" with "article bees" + And I fill in "search-input" with "bees and" And I press "Search" Then I should see "bees and butterflies" within "#search-results" - - Scenario: filter contents by facet - Given the following categories - | name | parent | - | Software Livre | tematicas | - | Big Brother | tematicas | - And the following articles - | owner | name | body | category | - | joaosilva | noosfero and debian | this is an article about noosfero and debian | software-livre | - | joaosilva | facebook and 1984 | this is an article about facebook and 1984 | big-brother | - When I go to the search articles page - And I fill in "search-input" with "this is an article" - And I press "Search" - # Then show me the page - And I follow "Software Livre" within "#facets-menu" - Then I should see "noosfero and debian" within "#search-results" - And I should not see "facebook and 1984" - # facet should also be de-selectable - When I follow "remove facet" within ".facet-selected" - Then I should see "facebook and 1984" - - Scenario: remember facet filter when searching new query - Given the following category - | name | parent | - | Software Livre | tematicas | - And the following articles - | owner | name | body | category | - | joaosilva | noosfero and debian | this is an article about noosfero and debian | software-livre | - | joaosilva | facebook and 1984 | this is an article about facebook and 1984 | big-brother | - | joaosilva | facebook defense | facebook is not so bad | software-livre | - When I go to the search articles page - And I fill in "search-input" with "this is an article" - And I press "Search" - And I follow "Software Livre" within "#facets-menu" - And I fill in "search-input" with "facebook" - And I press "Search" - Then I should see "facebook defense" within "#search-results" - And I should not see "1984" diff --git a/features/search_enterprises.feature b/features/search_enterprises.feature index a748896..2a82358 100644 --- a/features/search_enterprises.feature +++ b/features/search_enterprises.feature @@ -4,14 +4,10 @@ Feature: search enterprises In order to find ones that interest me Background: - Given the search index is empty And the following enterprises | identifier | name | img | | shop1 | Shoes shop | shoes | | shop2 | Fruits shop | fruits | - And the following categories as facets - | name | - | Temáticas | Scenario: show recent enterprises on index Given there are no pending jobs @@ -44,6 +40,7 @@ Feature: search enterprises | owner | name | body | homepage | | shop1 | Shoes home | This is the homepage 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 | When I search enterprises for "shoes" + And I follow "Full" Then I should see "This is the homepage of" within ".search-enterprise-description" And I should see "about sho..." within ".search-enterprise-description" @@ -52,114 +49,15 @@ Feature: search enterprises | identifier | name | description | | shop3 | Clothes shop | This clothes 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. | When I search enterprises for "clothes" + And I follow "Full" And I should see "This clothes shop" within ".search-enterprise-description" And I should see "really import..." within ".search-enterprise-description" - Scenario: see default facets when searching - When I go to the search enterprises page - And I fill in "search-input" with "shoes" - And I press "Search" - Then I should see "City" within "#facets-menu" - - Scenario: see category facets when searching - When I go to the search enterprises page - And I fill in "search-input" with "shoes" - And I press "Search" - Then I should see "Temáticas" within "#facets-menu" - - Scenario: see region on facets and results - Given the following cities - | name | state | - | Pres. Prudente | SP | - And the following enterprises - | identifier | name | region | - | art-pp | Artesanato PP | Pres. Prudente | - When I go to the search enterprises page - And I fill in "search-input" with "Artesanato" - And I press "Search" - Then I should see "Pres. Prudente" within "#facet-menu-f_region" - And I should see ", SP" within "#facet-menu-f_region" - And I should see "City" within ".search-enterprise-region-label" - And I should see "Pres. Prudente, SP" within ".search-enterprise-region-name" - - Scenario: find enterprise by region - Given the following cities - | name | state | - | Pres. Prudente | SP | - And the following enterprises - | identifier | name | region | - | art-pp | Artesanato PP | Pres. Prudente | - When I go to the search enterprises page - And I fill in "search-input" with "Prudente" - And I press "Search" - Then I should see "Artesanato PP" within "#search-results" - - Scenario: find enterprise by category - Given the following categories - | name | - | Software Livre | - And the following enterprises - | identifier | name | category | - | noosfero | Noosfero | software-livre | - When I go to the search enterprises page - And I fill in "search-input" with "software" - And I press "Search" - Then I should see "Noosfero" within "#search-results" - And I should see "Software Livre" within ".search-enterprise-category" - - Scenario: show category hierarchy on search results - Given the following categories - | name | parent | - | Software Livre | | - | Rails | software-livre | - And the following enterprises - | identifier | name | category | - | noosfero | Noosfero | rails | - When I search enterprises for "Rails" - Then I should see "Software Livre" within ".search-enterprise-category" - And I should see "Rails" within ".search-enterprise-category" - Scenario: find enterprises without exact query Given the following enterprises | identifier | name | | noosfero | Noosfero Developers Association | When I go to the search enterprises page - And I fill in "search-input" with "Noosfero Association" + And I fill in "search-input" with "Noosfero Developers" And I press "Search" Then I should see "Noosfero Developers Association" within "#search-results" - - Scenario: filter enterprises by facet - Given the following category - | name | parent | - | Software Livre | tematicas | - And the following enterprises - | identifier | name | category | - | noosfero | Noosfero Developers | software-livre | - | facebook | Facebook Developers | | - When I go to the search enterprises page - And I fill in "search-input" with "Developers" - And I press "Search" - And I follow "Software Livre" within "#facets-menu" - Then I should see "Noosfero Developers" within "#search-results" - And I should not see "Facebook Developers" - # facet should also be de-selectable - When I follow "remove facet" within ".facet-selected" - Then I should see "Facebook Developers" - - Scenario: remember facet filter when searching new query - Given the following category - | name | parent | - | Software Livre | tematicas | - And the following enterprises - | identifier | name | category | - | noosfero | Noosfero Developers | software-livre | - | rails-dev | Rails Developers | | - | rails-usr | Rails Users | software-livre | - When I go to the search enterprises page - And I fill in "search-input" with "Developers" - And I press "Search" - And I follow "Software Livre" within "#facets-menu" - And I fill in "search-input" with "Rails" - And I press "Search" - Then I should see "Rails Users" within "#search-results" - And I should not see "Rails Developers" diff --git a/features/search_people.feature b/features/search_people.feature index b8aca40..c377794 100644 --- a/features/search_people.feature +++ b/features/search_people.feature @@ -4,8 +4,7 @@ Feature: search people In order to find ones that interest me Background: - Given the search index is empty - And the following users + Given the following users | login | name | | joaosilva | Joao Silva | | josearaujo | Jose Araujo | @@ -27,76 +26,11 @@ Feature: search people When I search people for "something unrelated" Then I should see "None" within ".search-results-type-empty" - Scenario: see category facets when searching - Given the following categories as facets - | name | - | Temáticas | - When I go to the search people page - And I fill in "search-input" with "joao" - And I press "Search" - Then I should see "Temáticas" within "#facets-menu" - - Scenario: search people by category - Given the following category - | name | - | Software Livre | - And the following users - | login | name | category | - | linus | Linus Torvalds | software-livre | - When I go to the search people page - And I fill in "search-input" with "software livre" - And I press "Search" - Then I should see "Linus Torvalds" within "#search-results" - And I should not see "Joao Silva" - And I should not see "Jose Araujo" - Scenario: find person without exact query Given the following users | login | name | | jsilva | Joao Adalberto de Oliveira Silva | When I go to the search people page - And I fill in "search-input" with "Adalberto Silva" + And I fill in "search-input" with "Adalberto de Oliveira" And I press "Search" Then I should see "Joao Adalberto de Oliveira Silva" within "#search-results" - - Scenario: filter people by facet - Given the following categories as facets - | name | - | Temáticas | - And the following category - | name | parent | - | Software Livre | tematicas | - And the following users - | login | name | category | - | linus | Linus Torvalds | software-livre | - | other | Other Linus | | - When I go to the search people page - And I fill in "search-input" with "Linus" - And I press "Search" - And I follow "Software Livre" within "#facets-menu" - Then I should see "Linus Torvalds" within "#search-results" - And I should not see "Other Linus" - # facet should also be de-selectable - When I follow "remove facet" within ".facet-selected" - Then I should see "Other Linus" - - Scenario: remember facet filter when searching new query - Given the following categories as facets - | name | - | Temáticas | - And the following category - | name | parent | - | Software Livre | tematicas | - And the following users - | login | name | category | - | linus | Linus Torvalds | software-livre | - | rilin | Richard Linus | | - | stall | Richard Stallman | software-livre | - When I go to the search people page - And I fill in "search-input" with "Linus" - And I press "Search" - And I follow "Software Livre" within "#facets-menu" - And I fill in "search-input" with "Richard" - And I press "Search" - Then I should see "Richard Stallman" within "#search-results" - And I should not see "Richard Linus" diff --git a/features/search_products.feature b/features/search_products.feature index 8de2bfe..c2aaef1 100644 --- a/features/search_products.feature +++ b/features/search_products.feature @@ -4,8 +4,7 @@ Feature: search products In order to find ones that interest me Background: - Given the search index is empty - And feature "disable_asset_products" is disabled on environment + Given feature "disable_asset_products" is disabled on environment And the following enterprises | identifier | name | | colivre-ent | Colivre | @@ -22,11 +21,6 @@ Feature: search products Then I should see "wikis consultancy" within "#search-results" And I should see "social networks consultancy" within "#search-results" - Scenario: not show pagination and facets on recent products - When I go to the search products page - Then The page should not contain "div.pagination" - And The page should not contain "#facets-menu" - Scenario: show empty search results When I search products for "something unrelated" Then I should see "None" within ".search-results-type-empty" @@ -40,14 +34,6 @@ Feature: search products And I should not see "social networks consultancy" And I should not see social networks consultancy's product image - Scenario: see default facets when searching - When I go to the search products page - And I fill in "search-input" with "wikis" - And I press "Search" - Then I should see "Related products" within "#facets-menu" - Then I should see "City" within "#facets-menu" - Then I should see "Qualifiers" within "#facets-menu" - Scenario: show percentage (100%) of solidary economy inputs in results Given the following inputs | product | category | solidary | @@ -101,58 +87,6 @@ Feature: search products Then I should not see "No image" And I should see "Zoom in" within "a.zoomify-image" - Scenario: search products by category - Given the following product_category - | name | - | Software Livre | - And the following product - | owner | name | category | - | colivre-ent | Noosfero | software-livre | - When I go to the search products page - And I fill in "search-input" with "software livre" - And I press "Search" - Then I should see "Noosfero" within "#search-results" - And I should not see "wikis consultancy" - And I should not see "social networks consultancy" - - Scenario: see region on facets and results - Given the following cities - | name | state | - | Pres. Prudente | SP | - And the following enterprise - | identifier | name | region | - | art-pp | Artesanato PP | Pres. Prudente | - And the following product_category - | name | - | Solidária | - And the following product - | owner | name | category | - | art-pp | Arte em Madeira | solidaria | - When I go to the search products page - And I fill in "search-input" with "Madeira" - And I press "Search" - Then I should see "Pres. Prudente" within "#facet-menu-f_region" - And I should see ", SP" within "#facet-menu-f_region" - And I should see "Pres. Prudente, SP" within "#search-results" - - Scenario: find product by region - Given the following cities - | name | state | - | Pres. Prudente | SP | - And the following enterprise - | identifier | name | region | - | art-pp | Artesanato PP | Pres. Prudente | - And the following product_category - | name | - | Solidária | - And the following product - | owner | name | category | - | art-pp | Arte em Madeira | solidaria | - When I go to the search products page - And I fill in "search-input" with "Prudente" - And I press "Search" - Then I should see "Arte em Madeira" within "#search-results" - Scenario: find products without exact query Given the following product_category | name | @@ -161,63 +95,10 @@ Feature: search products | owner | name | category | | colivre-ent | Noosfero Social Network Platform | software-livre | When I go to the search products page - And I fill in "search-input" with "Noosfero Network" + And I fill in "search-input" with "Noosfero Social" And I press "Search" Then I should see "Noosfero Social Network Platform" within "#search-results" - Scenario: filter products by facet - Given the following enterprises - | identifier | name | - | fb | FB inc. | - And the following categories as facets - | name | - | Temáticas | - And the following product_categories - | name | parent | - | Software Livre | tematicas | - | Big Brother | tematicas | - And the following products - | owner | name | category | - | colivre-ent | Noosfero Network | software-livre | - | fb | Facebook Network | big-brother | - When I go to the search products page - And I fill in "search-input" with "Network" - And I press "Search" - And I follow "Software Livre" within "#facets-menu" - Then I should see "Noosfero Network" within "#search-results" - And I should not see "Facebook Network" - # facet should also be de-selectable - When I follow "remove facet" within ".facet-selected" - Then I should see "Facebook Network" - - Scenario: remember facet filter when searching new query - Given the following enterprises - | identifier | name | - | fb | FB inc. | - | other | Other | - And the following categories as facets - | name | - | Temáticas | - And the following product_categories - | name | parent | - | Software Livre | tematicas | - | Big Brother | tematicas | - | Other | tematicas | - And the following products - | owner | name | category | - | colivre-ent | Noosfero Network | software-livre | - | fb | Facebook Network | big-brother | - | other | Other open | software-livre | - | other | Other closed | big-brother | - When I go to the search products page - And I fill in "search-input" with "Network" - And I press "Search" - And I follow "Software Livre" within "#facets-menu" - And I fill in "search-input" with "Other" - And I press "Search" - Then I should see "Other open" within "#search-results" - And I should not see "Other closed" - Scenario: don't search when products are disabled in environment Given feature "disable_asset_products" is enabled on environment When I go to the search products page diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index 932f627..ffdc2aa 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -615,25 +615,6 @@ Given /^([^\s]+) (enabled|disabled) translation redirection in (?:his|her) profi profile.save end -Given /^the search index is empty$/ do - ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => '*:*')) -end - -# This could be merged with "the following categories" -Given /^the following categories as facets$/ do |table| - ids = [] - table.hashes.each do |item| - cat = Category.find_by_name(item[:name]) - if cat.nil? - cat = Category.create!(:environment_id => Environment.default.id, :name => item[:name]) - end - ids << cat.id - end - env = Environment.default - env.top_level_category_as_facet_ids = ids - env.save! -end - Given /^the following cities$/ do |table| table.hashes.each do |item| state = State.find_by_acronym item[:state] diff --git a/plugins/solr/features/.search_products.feature.swp b/plugins/solr/features/.search_products.feature.swp new file mode 100644 index 0000000..93789c7 Binary files /dev/null and b/plugins/solr/features/.search_products.feature.swp differ diff --git a/plugins/solr/features/search_communities.feature b/plugins/solr/features/search_communities.feature new file mode 100644 index 0000000..9ded7ec --- /dev/null +++ b/plugins/solr/features/search_communities.feature @@ -0,0 +1,93 @@ +Feature: search + As a noosfero user + I want to search + In order to find stuff + + Background: + Given the search index is empty + And the following category + | name | + | social network | + And the following community + | identifier | name | category | img | + | noosfero | Noosfero Community | social-network | noosfero-network | + + Scenario: search communities by category + Given the following category + | name | + | Software Livre | + And the following community + | identifier | name | category | + | noos-comm | Noosfero Community | software-livre | + When I go to the search communities page + And I fill in "search-input" with "software livre" + And I press "Search" + Then I should see "Noosfero" within "#search-results" + + Scenario: see category facets when searching + Given the following categories as facets + | name | + | Temáticas | + And the following category + | name | parent | + | Software Livre | tematicas | + And the following community + | identifier | name | category | + | linux | Linux Community | software-livre | + When I go to the search communities page + And I fill in "search-input" with "Linux" + And I press "Search" + Then I should see "Temáticas" within "#facets-menu" + + Scenario: find communities without exact query + Given the following communities + | identifier | name | + | luwac | Linux Users Without a Clue | + When I go to the search communities page + And I fill in "search-input" with "Linux Clue" + And I press "Search" + Then I should see "Linux Users Without a Clue" within "#search-results" + + Scenario: filter communities by facet + Given the following categories as facets + | name | + | Temáticas | + And the following category + | name | parent | + | Software Livre | tematicas | + | Big Brother | tematicas | + And the following communities + | identifier | name | category | + | noos-dev | Noosfero Developers | software-livre | + | facebook | Facebook Developers | big-brother | + When I go to the search communities page + And I fill in "search-input" with "Developers" + And I press "Search" + And I follow "Software Livre" within "#facets-menu" + Then I should see "Noosfero Developers" within "#search-results" + And I should not see "Facebook Developers" + # facet should also be de-selectable + When I follow "remove facet" within ".facet-selected" + Then I should see "Facebook Developers" + + Scenario: remember facet filter when searching new query + Given the following categories as facets + | name | + | Temáticas | + And the following category + | name | parent | + | Software Livre | tematicas | + | Other Category | tematicas | + And the following communities + | identifier | name | category | + | noos-dev | Noosfero Developers | software-livre | + | rails-dev | Rails Developers | other-category | + | rails-usr | Rails Users | software-livre | + When I go to the search communities page + And I fill in "search-input" with "Developers" + And I press "Search" + And I follow "Software Livre" within "#facets-menu" + And I fill in "search-input" with "Rails" + And I press "Search" + Then I should see "Rails Users" within "#search-results" + And I should not see "Rails Developers" diff --git a/plugins/solr/features/search_contents.feature b/plugins/solr/features/search_contents.feature new file mode 100644 index 0000000..b4cbbfd --- /dev/null +++ b/plugins/solr/features/search_contents.feature @@ -0,0 +1,84 @@ +Feature: search contents + As a noosfero user + I want to search contents + In order to find ones that interest me + + Background: + Given the search index is empty + And the following users + Given the following users + | login | name | + | joaosilva | Joao Silva | + And the following articles + | owner | name | body | + | joaosilva | bees and butterflies | this is an article about bees and butterflies | + | joaosilva | whales and dolphins | this is an article about whales and dolphins | + And the following categories as facets + | name | + | Temáticas | + + Scenario: search articles by category + Given the following category + | name | + | Software Livre | + And the following articles + | owner | name | body | category | + | joaosilva | using noosfero | noosfero is a great CMS | software-livre | + When I go to the search articles page + And I fill in "search-input" with "Software" + And I press "Search" + Then I should see "using noosfero" within "#search-results" + And I should not see "bees and butterflies" + And I should not see "whales and dolphins" + + Scenario: see default facets when searching + When I go to the search articles page + And I fill in "search-input" with "bees" + And I press "Search" + Then I should see "Type" within "#facets-menu" + And I should see "Published date" within "#facets-menu" + And I should see "Profile" within "#facets-menu" + And I should see "Categories" within "#facets-menu" + + Scenario: find enterprises without exact query + When I go to the search articles page + And I fill in "search-input" with "bees and" + And I press "Search" + Then I should see "bees and butterflies" within "#search-results" + + Scenario: filter contents by facet + Given the following categories + | name | parent | + | Software Livre | tematicas | + | Big Brother | tematicas | + And the following articles + | owner | name | body | category | + | joaosilva | noosfero and debian | this is an article about noosfero and debian | software-livre | + | joaosilva | facebook and 1984 | this is an article about facebook and 1984 | big-brother | + When I go to the search articles page + And I fill in "search-input" with "this is an article" + And I press "Search" + And I follow "Software Livre" within "#facets-menu" + Then I should see "noosfero and debian" within "#search-results" + And I should not see "facebook and 1984" + # facet should also be de-selectable + When I follow "remove facet" within ".facet-selected" + Then I should see "facebook and 1984" + + Scenario: remember facet filter when searching new query + Given the following category + | name | parent | + | Software Livre | tematicas | + And the following articles + | owner | name | body | category | + | joaosilva | noosfero and debian | this is an article about noosfero and debian | software-livre | + | joaosilva | facebook and 1984 | this is an article about facebook and 1984 | big-brother | + | joaosilva | facebook defense | facebook is not so bad | software-livre | + When I go to the search articles page + And I fill in "search-input" with "this is an article" + And I press "Search" + And I follow "Software Livre" within "#facets-menu" + And I fill in "search-input" with "facebook" + And I press "Search" + Then I should see "facebook defense" within "#search-results" + And I should not see "1984" diff --git a/plugins/solr/features/search_enterprises.feature b/plugins/solr/features/search_enterprises.feature new file mode 100644 index 0000000..ed6b99a --- /dev/null +++ b/plugins/solr/features/search_enterprises.feature @@ -0,0 +1,122 @@ +Feature: search enterprises + As a noosfero user + I want to search enterprises + In order to find ones that interest me + + Background: + Given the search index is empty + And the following enterprises + | identifier | name | img | + | shop1 | Shoes shop | shoes | + | shop2 | Fruits shop | fruits | + And the following categories as facets + | name | + | Temáticas | + Scenario: see default facets when searching + When I go to the search enterprises page + And I fill in "search-input" with "shoes" + And I press "Search" + Then I should see "City" within "#facets-menu" + + Scenario: see category facets when searching + When I go to the search enterprises page + And I fill in "search-input" with "shoes" + And I press "Search" + Then I should see "Temáticas" within "#facets-menu" + + Scenario: see region on facets and results + Given the following cities + | name | state | + | Pres. Prudente | SP | + And the following enterprises + | identifier | name | region | + | art-pp | Artesanato PP | Pres. Prudente | + When I go to the search enterprises page + And I fill in "search-input" with "Artesanato" + And I press "Search" + Then I should see "Pres. Prudente" within "#facet-menu-f_region" + And I should see ", SP" within "#facet-menu-f_region" + And I should see "City" within ".search-enterprise-region-label" + And I should see "Pres. Prudente, SP" within ".search-enterprise-region-name" + + Scenario: find enterprise by region + Given the following cities + | name | state | + | Pres. Prudente | SP | + And the following enterprises + | identifier | name | region | + | art-pp | Artesanato PP | Pres. Prudente | + When I go to the search enterprises page + And I fill in "search-input" with "Prudente" + And I press "Search" + Then I should see "Artesanato PP" within "#search-results" + + Scenario: find enterprise by category + Given the following categories + | name | + | Software Livre | + And the following enterprises + | identifier | name | category | + | noosfero | Noosfero | software-livre | + When I go to the search enterprises page + And I fill in "search-input" with "software" + And I press "Search" + Then I should see "Noosfero" within "#search-results" + And I should see "Software Livre" within ".search-enterprise-category" + + Scenario: show category hierarchy on search results + Given the following categories + | name | parent | + | Software Livre | | + | Rails | software-livre | + And the following enterprises + | identifier | name | category | + | noosfero | Noosfero | rails | + When I search enterprises for "Rails" + Then I should see "Software Livre" within ".search-enterprise-category" + And I should see "Rails" within ".search-enterprise-category" + + Scenario: find enterprises without exact query + Given the following enterprises + | identifier | name | + | noosfero | Noosfero Developers Association | + When I go to the search enterprises page + And I fill in "search-input" with "Noosfero Association" + And I press "Search" + Then I should see "Noosfero Developers Association" within "#search-results" + + Scenario: filter enterprises by facet + Given the following category + | name | parent | + | Software Livre | tematicas | + And the following enterprises + | identifier | name | category | + | noosfero | Noosfero Developers | software-livre | + | facebook | Facebook Developers | | + When I go to the search enterprises page + And I fill in "search-input" with "Developers" + And I press "Search" + And I follow "Software Livre" within "#facets-menu" + Then I should see "Noosfero Developers" within "#search-results" + And I should not see "Facebook Developers" + # facet should also be de-selectable + When I follow "remove facet" within ".facet-selected" + Then I should see "Facebook Developers" + + Scenario: remember facet filter when searching new query + Given the following category + | name | parent | + | Software Livre | tematicas | + And the following enterprises + | identifier | name | category | + | noosfero | Noosfero Developers | software-livre | + | rails-dev | Rails Developers | | + | rails-usr | Rails Users | software-livre | + When I go to the search enterprises page + And I fill in "search-input" with "Developers" + And I press "Search" + And I follow "Software Livre" within "#facets-menu" + And I fill in "search-input" with "Rails" + And I press "Search" + Then I should see "Rails Users" within "#search-results" + And I should not see "Rails Developers" diff --git a/plugins/solr/features/search_people.feature b/plugins/solr/features/search_people.feature new file mode 100644 index 0000000..4f6d886 --- /dev/null +++ b/plugins/solr/features/search_people.feature @@ -0,0 +1,85 @@ +Feature: search people + As a noosfero user + I want to search people + In order to find ones that interest me + + Background: + Given the search index is empty + And the following users + | login | name | + | joaosilva | Joao Silva | + | josearaujo | Jose Araujo | + + Scenario: see category facets when searching + Given the following categories as facets + | name | + | Temáticas | + When I go to the search people page + And I fill in "search-input" with "joao" + And I press "Search" + Then I should see "Temáticas" within "#facets-menu" + + Scenario: search people by category + Given the following category + | name | + | Software Livre | + And the following users + | login | name | category | + | linus | Linus Torvalds | software-livre | + When I go to the search people page + And I fill in "search-input" with "software livre" + And I press "Search" + Then I should see "Linus Torvalds" within "#search-results" + And I should not see "Joao Silva" + And I should not see "Jose Araujo" + + Scenario: find person without exact query + Given the following users + | login | name | + | jsilva | Joao Adalberto de Oliveira Silva | + When I go to the search people page + And I fill in "search-input" with "Adalberto Silva" + And I press "Search" + Then I should see "Joao Adalberto de Oliveira Silva" within "#search-results" + + Given the following categories as facets + | name | + | Temáticas | + And the following category + | name | parent | + | Software Livre | tematicas | + And the following users + | login | name | category | + | linus | Linus Torvalds | software-livre | + | other | Other Linus | | + When I go to the search people page + And I fill in "search-input" with "Linus" + And I press "Search" + And I follow "Software Livre" within "#facets-menu" + Then I should see "Linus Torvalds" within "#search-results" + And I should not see "Other Linus" + # facet should also be de-selectable + When I follow "remove facet" within ".facet-selected" + Then I should see "Other Linus" + + Scenario: remember facet filter when searching new query + Given the following categories as facets + | name | + | Temáticas | + And the following category + | name | parent | + | Software Livre | tematicas | + And the following users + | login | name | category | + | linus | Linus Torvalds | software-livre | + | rilin | Richard Linus | | + | stall | Richard Stallman | software-livre | + When I go to the search people page + And I fill in "search-input" with "Linus" + And I press "Search" + And I follow "Software Livre" within "#facets-menu" + And I fill in "search-input" with "Richard" + And I press "Search" + Then I should see "Richard Stallman" within "#search-results" + And I should not see "Richard Linus" + diff --git a/plugins/solr/features/search_products.feature b/plugins/solr/features/search_products.feature new file mode 100644 index 0000000..0fb76ca --- /dev/null +++ b/plugins/solr/features/search_products.feature @@ -0,0 +1,149 @@ +Feature: search products + As a noosfero user + I want to search products + In order to find ones that interest me + + Background: + Given the search index is empty + And feature "disable_asset_products" is disabled on environment + And the following enterprises + | identifier | name | + | colivre-ent | Colivre | + And the following product_categories + | name | + | Development | + And the following products + | owner | category | name | price | img | + | colivre-ent | development | social networks consultancy | 1.00 | fruits | + | colivre-ent | development | wikis consultancy | 2.00 | shoes | + + Scenario: not show pagination and facets on recent products + When I go to the search products page + Then The page should not contain "div.pagination" + And The page should not contain "#facets-menu" + + Scenario: see default facets when searching + When I go to the search products page + And I fill in "search-input" with "wikis" + And I press "Search" + Then I should see "Related products" within "#facets-menu" + Then I should see "City" within "#facets-menu" + Then I should see "Qualifiers" within "#facets-menu" + + Scenario: search products by category + Given the following product_category + | name | + | Software Livre | + And the following product + | owner | name | category | + | colivre-ent | Noosfero | software-livre | + When I go to the search products page + And I fill in "search-input" with "software livre" + And I press "Search" + Then I should see "Noosfero" within "#search-results" + And I should not see "wikis consultancy" + And I should not see "social networks consultancy" + + Scenario: see region on facets and results + Given the following cities + | name | state | + | Pres. Prudente | SP | + And the following enterprise + | identifier | name | region | + | art-pp | Artesanato PP | Pres. Prudente | + And the following product_category + | name | + | Solidária | + And the following product + | owner | name | category | + | art-pp | Arte em Madeira | solidaria | + When I go to the search products page + And I fill in "search-input" with "Madeira" + And I press "Search" + Then I should see "Pres. Prudente" within "#facet-menu-f_region" + And I should see ", SP" within "#facet-menu-f_region" + And I should see "Pres. Prudente, SP" within "#search-results" + + Scenario: find product by region + Given the following cities + | name | state | + | Pres. Prudente | SP | + And the following enterprise + | identifier | name | region | + | art-pp | Artesanato PP | Pres. Prudente | + And the following product_category + | name | + | Solidária | + And the following product + | owner | name | category | + | art-pp | Arte em Madeira | solidaria | + When I go to the search products page + And I fill in "search-input" with "Prudente" + And I press "Search" + Then I should see "Arte em Madeira" within "#search-results" + + Scenario: find products without exact query + Given the following product_category + | name | + | Software Livre | + And the following products + | owner | name | category | + | colivre-ent | Noosfero Social Network Platform | software-livre | + When I go to the search products page + And I fill in "search-input" with "Noosfero Network" + And I press "Search" + Then I should see "Noosfero Social Network Platform" within "#search-results" + + Scenario: filter products by facet + Given the following enterprises + | identifier | name | + | fb | FB inc. | + And the following categories as facets + | name | + | Temáticas | + And the following product_categories + | name | parent | + | Software Livre | tematicas | + | Big Brother | tematicas | + And the following products + | owner | name | category | + | colivre-ent | Noosfero Network | software-livre | + | fb | Facebook Network | big-brother | + When I go to the search products page + And I fill in "search-input" with "Network" + And I press "Search" + And I follow "Software Livre" within "#facets-menu" + Then I should see "Noosfero Network" within "#search-results" + And I should not see "Facebook Network" + # facet should also be de-selectable + When I follow "remove facet" within ".facet-selected" + Then I should see "Facebook Network" + + Scenario: remember facet filter when searching new query + Given the following enterprises + | identifier | name | + | fb | FB inc. | + | other | Other | + And the following categories as facets + | name | + | Temáticas | + And the following product_categories + | name | parent | + | Software Livre | tematicas | + | Big Brother | tematicas | + | Other | tematicas | + And the following products + | owner | name | category | + | colivre-ent | Noosfero Network | software-livre | + | fb | Facebook Network | big-brother | + | other | Other open | software-livre | + | other | Other closed | big-brother | + When I go to the search products page + And I fill in "search-input" with "Network" + And I press "Search" + And I follow "Software Livre" within "#facets-menu" + And I fill in "search-input" with "Other" + And I press "Search" + Then I should see "Other open" within "#search-results" + And I should not see "Other closed" + diff --git a/plugins/solr/features/steps/solr_steps.rb b/plugins/solr/features/steps/solr_steps.rb new file mode 100644 index 0000000..403febe --- /dev/null +++ b/plugins/solr/features/steps/solr_steps.rb @@ -0,0 +1,18 @@ +Given /^the search index is empty$/ do + ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => '*:*')) +end + +# This could be merged with "the following categories" +Given /^the following categories as facets$/ do |table| + ids = [] + table.hashes.each do |item| + cat = Category.find_by_name(item[:name]) + if cat.nil? + cat = Category.create!(:environment_id => Environment.default.id, :name => item[:name]) + end + ids << cat.id + end + env = Environment.default + env.top_level_category_as_facet_ids = ids + env.save! +end -- libgit2 0.21.2