Skip to content
Snippets Groups Projects
Commit 92cc5dbc authored by Bruno Nocera Zanette's avatar Bruno Nocera Zanette
Browse files

Fix bug: Only 10 results && Minor Changes

parent 7217bffb
No related branches found
No related tags found
No related merge requests found
......@@ -3,10 +3,11 @@ class Search::SolrController < ApplicationController
def search
queryParams = {:q => '*:*', :fq => params[:qry]}
response = solr_client.get 'select',
results = solr_client.get 'select',
:params => merge_search_parameters(queryParams, solr_search_default_parameters)
@objectsFound = select_items_results(response)
@numFound = results["response"]["numFound"]
@objectsFound = select_items_from_results(results)
end
private
......@@ -15,13 +16,12 @@ class Search::SolrController < ApplicationController
# 2 = Item
# 3 = Collection
# 4 = Community
def select_items_results(results)
def select_items_from_results(results)
resultList = Set.new
results["response"]["docs"].select { |r|
r["search.resourcetype"].to_i.equal? 2
}.each do |i|
resultList.add i
puts i
end
return resultList
end
......@@ -38,14 +38,16 @@ class Search::SolrController < ApplicationController
return {
"fl"=>["
search.resourcetype, search.resourceid,
handle, author, title,
handle, author, title
"],
"type"=>"0",
"start"=>"0",
"rows"=>"1000",
"facet"=>"true",
"facet.offset"=>"0",
"facet.mincount"=>"1",
"f.subject_tax_0_filter.facet.sort"=>"count",
"f.subject_tax_0_filter.facet.limit"=>"11",
"start"=>"0",
"f.author_filter.facet.limit"=>"11",
"f.dateIssued.year.facet.sort"=>"index",
"f.dateIssued.year.facet.limit"=>"10",
......
module Search::SolrHelper
def object_thumbnail(handle)
return "http://demo.dspace.org/xmlui/bitstream/handle/10673/4/kitty-1257950690.jpg.jpg?sequence=10&isAllowed=y"
end
end
<% unless @objectsFound.empty? %>
<h3>Aulas</h3>
<h3>Objetos encontrados: <%= @numFound %></h3>
<div class="panel">
<ul>
<% @objectsFound.each do |i| %>
<li>
<%= image_tag( object_thumbnail(i["handle"]) ) %>
<b><%= link_to i["title"][0]%></b>
</li>
<% end %>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment