diff --git a/app/components/document_advanced_search_component/document_advanced_search_component.html.erb b/app/components/document_advanced_search_component/document_advanced_search_component.html.erb
index a0c1f99..478e65f 100644
--- a/app/components/document_advanced_search_component/document_advanced_search_component.html.erb
+++ b/app/components/document_advanced_search_component/document_advanced_search_component.html.erb
@@ -13,24 +13,26 @@
<%= text_field_tag :title, params[:short_title], class: "form-control mb-0" %>
-
-
- <%= text_field_tag :title, params[:short_title], class: "form-control mb-0" %>
-
-
-
-
- <%= text_field_tag :title, params[:short_title], class: "form-control mb-0" %>
-
+ <% if opts[:is_decisions_index].present? %>
+
+
+ <%= text_field_tag :ponente, params[:ponente], class: "form-control mb-0" %>
+
+
+
+
+ <%= text_field_tag :syllabus, params[:syllabus], class: "form-control mb-0" %>
+
+ <% end %>
+
-
- <%= select_tag :year, options_for_select(years, params[:year]), class: "form-select", include_blank: true %>
+ <%= select_tag :year_start, options_for_select(years, params[:year_start]), class: "form-select", include_blank: true %>
- <%= select_tag :year, options_for_select(years, params[:year]), class: "form-select", include_blank: true %>
+ <%= select_tag :year_end, options_for_select(years, params[:year_end]), class: "form-select", include_blank: true %>
diff --git a/app/controllers/concerns/jurisprudence_search.rb b/app/controllers/concerns/jurisprudence_search.rb
index bf12ce9..d80abe0 100644
--- a/app/controllers/concerns/jurisprudence_search.rb
+++ b/app/controllers/concerns/jurisprudence_search.rb
@@ -5,11 +5,17 @@ module JurisprudenceSearch
search = Cdao::Jurisprudence.search do
fulltext search_params[:q], fields: fulltext_fields if search_params[:q].present?
- fulltext_fields.each do |field|
- fulltext search_params[field], fields: [field] if search_params[field].present?
+ %i[reference_number title short_title ponente syllabus].each do |field|
+ fulltext search_params[field], fields: [field], query_phrase_slop: 1 if search_params[field].present?
end
- with(:year, search_params[:year].to_i) if search_params[:year].present?
+ if search_params[:year_start].present? && search_params[:year_end].present?
+ with(:year).between(search_params[:year_start].to_i..search_params[:year_start].to_i)
+ end
+
+ if search_params[:year_start].present? && search_params[:year_end].blank?
+ with(:year, search_params[:year_start].to_i)
+ end
with(:subject_ids).any_of(search_params[:subject_ids].split(",").map(&:strip).map(&:to_i)) if search_params[:subject_ids].present?
diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb
index f5b03b9..f102b36 100644
--- a/app/controllers/documents_controller.rb
+++ b/app/controllers/documents_controller.rb
@@ -33,8 +33,8 @@ class DocumentsController < ApplicationController
private
def search_params
- params.permit(:reference_number, :title, :short_title,
- :year, :citation_finder, :subject_ids,
+ params.permit(:reference_number, :title, :short_title, :ponente, :syllabus,
+ :year_start, :year_end, :citation_finder, :subject_ids,
:q, :page, :per_page)
end
end
diff --git a/app/models/cdao/jurisprudence.rb b/app/models/cdao/jurisprudence.rb
index 152e307..980a911 100644
--- a/app/models/cdao/jurisprudence.rb
+++ b/app/models/cdao/jurisprudence.rb
@@ -132,15 +132,21 @@ class Cdao::Jurisprudence < Cdao::Base
text :reference_number, stored: true
text :title, stored: true
text :short_title, stored: true
+ text :ponente, stored: true
+ text :syllabus, stored: true
string :reference_number
+ string :ponente
+ string :syllabus
string :title do
(title.present? ? title.first(32760).strip : short_title || "").titleize
end
string :short_title do
(short_title.presence || title.first(32760).strip || "").titleize
end
- string :citation_finders_names, multiple: true
+ string :citation_finders_names, multiple: true do
+ citation_finders_names
+ end
date :doc_date
date :search_doc_date do
diff --git a/app/views/decisions/index.html.erb b/app/views/decisions/index.html.erb
index 339f1e6..2b03824 100644
--- a/app/views/decisions/index.html.erb
+++ b/app/views/decisions/index.html.erb
@@ -1,7 +1,7 @@
- <%= render(DocumentAdvancedSearchComponent.new(current_user: current_user, opts: {})) %>
+ <%= render(DocumentAdvancedSearchComponent.new(current_user: current_user, opts: { is_decisions_index: true })) %>