Module: MediaWiktory::Wikipedia::Modules::GSearch
- Defined in:
- lib/mediawiktory/wikipedia/modules/g-search.rb
Overview
Perform a full text search. Generator module: for fetching pages corresponding to request.
The "submodule" (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for Actions::Query and its submodules):
api.query # returns Actions::Query
.prop(:revisions) # adds prop=revisions to action URL, and includes Modules::Revisions into action
.limit(10) # method of Modules::Revisions, adds rvlimit=10 to URL
All submodule's parameters are documented as its public methods, see below.
Instance Method Summary collapse
-
#enablerewrites ⇒ self
Enable internal query rewriting.
-
#info(*values) ⇒ self
Which metadata to return.
-
#interwiki ⇒ self
Include interwiki results in the search, if available.
-
#limit(value) ⇒ self
How many total pages to return.
-
#namespace(*values) ⇒ self
Search only within these namespaces.
-
#offset(value) ⇒ self
When more results are available, use this to continue.
-
#qiprofile(value) ⇒ self
Query independent profile to use (affects ranking algorithm).
-
#search(value) ⇒ self
Search for page titles or content matching this value.
-
#what(value) ⇒ self
Which type of search to perform.
Instance Method Details
#enablerewrites ⇒ self
Enable internal query rewriting. Some search backends can rewrite the query into one its thinks gives better results, such as correcting spelling errors.
107 108 109 |
# File 'lib/mediawiktory/wikipedia/modules/g-search.rb', line 107 def enablerewrites() merge(gsrenablerewrites: 'true') end |
#info(*values) ⇒ self
Which metadata to return.
88 89 90 |
# File 'lib/mediawiktory/wikipedia/modules/g-search.rb', line 88 def info(*values) values.inject(self) { |res, val| res._info(val) or fail ArgumentError, "Unknown value for info: #{val}" } end |
#interwiki ⇒ self
Include interwiki results in the search, if available.
100 101 102 |
# File 'lib/mediawiktory/wikipedia/modules/g-search.rb', line 100 def interwiki() merge(gsrinterwiki: 'true') end |
#limit(value) ⇒ self
How many total pages to return.
46 47 48 |
# File 'lib/mediawiktory/wikipedia/modules/g-search.rb', line 46 def limit(value) merge(gsrlimit: value.to_s) end |
#namespace(*values) ⇒ self
Search only within these namespaces.
33 34 35 |
# File 'lib/mediawiktory/wikipedia/modules/g-search.rb', line 33 def namespace(*values) values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, "Unknown value for namespace: #{val}" } end |
#offset(value) ⇒ self
When more results are available, use this to continue.
54 55 56 |
# File 'lib/mediawiktory/wikipedia/modules/g-search.rb', line 54 def offset(value) merge(gsroffset: value.to_s) end |
#qiprofile(value) ⇒ self
Query independent profile to use (affects ranking algorithm).
62 63 64 |
# File 'lib/mediawiktory/wikipedia/modules/g-search.rb', line 62 def qiprofile(value) _qiprofile(value) or fail ArgumentError, "Unknown value for qiprofile: #{value}" end |
#search(value) ⇒ self
Search for page titles or content matching this value. You can use the search string to invoke special search features, depending on what the wiki's search backend implements.
25 26 27 |
# File 'lib/mediawiktory/wikipedia/modules/g-search.rb', line 25 def search(value) merge(gsrsearch: value.to_s) end |
#what(value) ⇒ self
Which type of search to perform.
75 76 77 |
# File 'lib/mediawiktory/wikipedia/modules/g-search.rb', line 75 def what(value) _what(value) or fail ArgumentError, "Unknown value for what: #{value}" end |