aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMarc Florisson2012-12-06 17:39:48 +0100
committerMarc Florisson2012-12-06 17:39:48 +0100
commit0b24329d0fc53a226e801f7626d690a59be3d29d (patch)
treeb9852929b1e2852f88784e4809e5492a7da2a0eb /app
parentc57e39e2b2ef4152e35c1b886aaffc6536121fab (diff)
downloadchouette-core-0b24329d0fc53a226e801f7626d690a59be3d29d.tar.bz2
add lexico search on api/v1
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/v1/companies_controller.rb2
-rw-r--r--app/controllers/api/v1/connection_links_controller.rb2
-rw-r--r--app/controllers/api/v1/lines_controller.rb2
-rw-r--r--app/controllers/api/v1/networks_controller.rb2
-rw-r--r--app/controllers/api/v1/stop_areas_controller.rb6
-rw-r--r--app/controllers/api/v1/time_tables_controller.rb2
-rw-r--r--app/views/api/v1/stop_areas/show.rabl10
7 files changed, 10 insertions, 16 deletions
diff --git a/app/controllers/api/v1/companies_controller.rb b/app/controllers/api/v1/companies_controller.rb
index 3f2cd2e7b..5e71d2eb5 100644
--- a/app/controllers/api/v1/companies_controller.rb
+++ b/app/controllers/api/v1/companies_controller.rb
@@ -6,7 +6,7 @@ class Api::V1::CompaniesController < Api::V1::ChouetteController
protected
def collection
- @companies ||= referential.companies
+ @companies ||= referential.companies.search(params[:q]).result(:distinct => true)
end
end
diff --git a/app/controllers/api/v1/connection_links_controller.rb b/app/controllers/api/v1/connection_links_controller.rb
index 7aa072cf3..b1e23d413 100644
--- a/app/controllers/api/v1/connection_links_controller.rb
+++ b/app/controllers/api/v1/connection_links_controller.rb
@@ -6,7 +6,7 @@ class Api::V1::ConnectionLinksController < Api::V1::ChouetteController
protected
def collection
- @connection_links ||= referential.connection_links
+ @connection_links ||= referential.connection_links.search(params[:q]).result(:distinct => true)
end
end
diff --git a/app/controllers/api/v1/lines_controller.rb b/app/controllers/api/v1/lines_controller.rb
index 2e22161d0..1df8a6618 100644
--- a/app/controllers/api/v1/lines_controller.rb
+++ b/app/controllers/api/v1/lines_controller.rb
@@ -8,7 +8,7 @@ module Api
protected
def collection
- @lines ||= referential.lines
+ @lines ||= referential.lines.search(params[:q]).result(:distinct => true)
end
end
end
diff --git a/app/controllers/api/v1/networks_controller.rb b/app/controllers/api/v1/networks_controller.rb
index 7443445df..0b014e27b 100644
--- a/app/controllers/api/v1/networks_controller.rb
+++ b/app/controllers/api/v1/networks_controller.rb
@@ -8,7 +8,7 @@ module Api
protected
def collection
- @networks ||= referential.networks
+ @networks ||= referential.networks.search(params[:q]).result(:distinct => true)
end
end
end
diff --git a/app/controllers/api/v1/stop_areas_controller.rb b/app/controllers/api/v1/stop_areas_controller.rb
index 97d2dec7d..2d5a176ae 100644
--- a/app/controllers/api/v1/stop_areas_controller.rb
+++ b/app/controllers/api/v1/stop_areas_controller.rb
@@ -10,7 +10,11 @@ class Api::V1::StopAreasController < Api::V1::ChouetteController
protected
def collection
- @stop_areas ||= parent.stop_areas
+ if parent
+ @stop_areas ||= parent.stop_areas.search(params[:q]).result(:distinct => true)
+ else
+ @stop_areas ||= referential.stop_areas.search(params[:q]).result(:distinct => true)
+ end
end
end
diff --git a/app/controllers/api/v1/time_tables_controller.rb b/app/controllers/api/v1/time_tables_controller.rb
index 53f564a52..eb54b5444 100644
--- a/app/controllers/api/v1/time_tables_controller.rb
+++ b/app/controllers/api/v1/time_tables_controller.rb
@@ -6,7 +6,7 @@ class Api::V1::TimeTablesController < Api::V1::ChouetteController
protected
def collection
- @time_tables ||= referential.time_tables
+ @time_tables ||= referential.time_tables.search(params[:q]).result(:distinct => true)
end
end
diff --git a/app/views/api/v1/stop_areas/show.rabl b/app/views/api/v1/stop_areas/show.rabl
index 032efe1a1..db0f628bb 100644
--- a/app/views/api/v1/stop_areas/show.rabl
+++ b/app/views/api/v1/stop_areas/show.rabl
@@ -9,13 +9,3 @@ attributes :country_code, :street_name
child :parent => :parent do
attributes :objectid, :name, :area_type, :longitude, :latitude, :long_lat_type
end
-
-child :children_in_depth => :children do |stop_area|
- node(:stop_area) do |n|
- { :objectid => n.stop_area.objectid, :name => n.stop_area.name,
- :parent => n.stop_area.parent.objectid,
- :area_type => n.stop_area.area_type,
- :longitude => n.stop_area.longitude, :latitude => n.stop_area.latitude,
- :long_lat_type => n.stop_area.long_lat_type}
- end
-end