app/controllers/v1/search_controller.rb
# public search function
# it takes following parameters:
# 	query_scope:
# 	    1. this parameter tells solr app the scope which it should be searching in  
# 		2. this one is optional, could be left blank
# 		3. could be 'all', 'user' or 'promotion'
# 			or all combinations seperated by ',,': 'user,,promotion'
# 	excludes: 
# 		1. results should not be included the result list
# 		2. it should be model ids'
# 			  for example:  excludes=1233344t,,5464564646
#   subscripted:
#   	1. if only searching in subscripted users and promotions
#   	2. could be nil, true or false
#   lat: latitude
#   long: longtitude
#   distance: results within the distance 
#   page:
#   per_page:
public search function
it takes following parameters:
query_scope:
1. this parameter tells solr app the scope which it should be searching in
2. this one is optional, could be left blank
3.
public search function it takes following parameters : query_scope : 1 . this parameter tells solr app the scope which it should be searching in 2 . this one is optional could be left blank 3 .
def query
		puts finalOptions
		query_scope = finalOptions[:query_scope].downcase.split(',,')
		@models = []
		@excludes = finalOptions[:excludes].split(',,')
		@models << User if query_scope.include? 'user'
		@models << Promotion if query_scope.include? 'promotion'
		@model_names = @models.map { |model| model.name.downcase }
		@search = self.search_func(@excludes)
		@hits = @search.hits.map { |hit| { :class_name => hit.class_name, :result => hit.result } }
		render 'search/results', :locals => { :hits => @hits }
	end
def query puts finalOptions query_scope = finalOptions [ :query_scope ] . downcase . split ( ',,' ) @models = [ ] @excludes = finalOptions [ :excludes ] . split ( ',,' ) @models << User if query_scope . include? 'user' @models << Promotion if query_scope . include? 'promotion' @model_names = @models . map { | model | model . name . downcase } @search = self . search_func ( @excludes ) @hits = @search . hits . map { | hit | { :class_name => hit . class_name , :result => hit . result } } render 'search/results' , :locals => { :hits => @hits } end
public search function
it takes following parameters:
query_scope:
1. this parameter tells solr app the scope which it should be searching in
2. this one is optional, could be left blank
3. could be 'all', 'user' or 'promotion'
or all combinations seperated by ',,': 'user,,promotion'
excludes:
1. results should not be included the result list
2. it should be model ids'
for example:  excludes=1233344t,,5464564646
subscripted:
1. if only searching in subscripted users and promotions
2. could be nil, true or false
lat: latitude
long: longtitude
distance: results within the distance
page:
per_page:
public search function it takes following parameters : query_scope : 1 . this parameter tells solr app the scope which it should be searching in 2 . this one is optional could be left blank 3 . could be ' all ' ' user ' or ' promotion ' or all combinations seperated by ' ' : ' user promotion ' excludes : 1 . results should not be included the result list 2 . it should be model ids ' for example : excludes = 1233344t 5464564646 subscripted : 1 . if only searching in subscripted users and promotions 2 . could be nil true or false lat : latitude long : longtitude distance : results within the distance page : per_page :
# get query scope # store the models that will be searched # get excludes (which should not be included in the results)