Class: AdvancedQueryString

Inherits:
Object
  • Object
show all
Defined in:
backend/app/model/advanced_query_string.rb

Instance Method Summary collapse

Constructor Details

#initialize(query, use_literal: false, protect_unpublished: false) ⇒ AdvancedQueryString

Returns a new instance of AdvancedQueryString.



4
5
6
7
8
# File 'backend/app/model/advanced_query_string.rb', line 4

def initialize(query, use_literal: false, protect_unpublished: false)
  @query = query.transform_keys { |k| k.to_s }
  @use_literal = use_literal
  @protect_unpublished = protect_unpublished
end

Instance Method Details

#to_solr_sObject



10
11
12
13
14
15
16
17
# File 'backend/app/model/advanced_query_string.rb', line 10

def to_solr_s
  return empty_solr_s if empty_search?
  if field.nil?
    "#{prefix}#{value}"
  else
    "#{prefix}#{field}:#{value}"
  end
end