Class: BingQueryParser
- Inherits:
-
Object
- Object
- BingQueryParser
- Defined in:
- lib/logstash/filters/parsers/bing.rb
Instance Method Summary collapse
-
#initialize ⇒ BingQueryParser
constructor
A new instance of BingQueryParser.
- #match(siteName) ⇒ Object
- #parse(query) ⇒ Object
Constructor Details
#initialize ⇒ BingQueryParser
Returns a new instance of BingQueryParser.
7 8 9 10 |
# File 'lib/logstash/filters/parsers/bing.rb', line 7 def initialize @re_url = /(?:www\.)?bing\..*/ @re_query = /^\/search\?(?:[^&]*&)?q=(?<query>[^&#]*)/i end |
Instance Method Details
#match(siteName) ⇒ Object
13 14 15 |
# File 'lib/logstash/filters/parsers/bing.rb', line 13 def match(siteName) return @re_url.match(siteName) end |
#parse(query) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/logstash/filters/parsers/bing.rb', line 17 def parse(query) query = Utils.removeInvalidChars(query) m = @re_query.match(query) if m then return m["query"].tr("+", " ").split.join(" ") end end |