.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.metacpan Namespace Reference

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
int number_of_results = 20
 
list categories = ["it", "packages"]
 
bool disabled = True
 
str shortcut = "cpan"
 
bool paging = True
 
dict query_data_template
 
 search_url = urlunparse(["https", "fastapi.metacpan.org", "/v1/file/_search", "", "", ""])
 

Detailed Description

metacpan

Function Documentation

◆ request()

searx.engines.metacpan.request ( query,
params )

Definition at line 53 of file metacpan.py.

53def request(query, params):
54 params["url"] = search_url
55 params["method"] = "POST"
56 query_data = query_data_template
57 query_data["query"]["multi_match"]["query"] = query
58 query_data["from"] = (params["pageno"] - 1) * number_of_results
59 params["data"] = dumps(query_data)
60 return params
61
62

◆ response()

searx.engines.metacpan.response ( resp)

Definition at line 63 of file metacpan.py.

63def response(resp):
64 results = []
65
66 search_results = resp.json()["hits"]["hits"]
67 for result in search_results:
68 fields = result["_source"]
69 module = fields["documentation"]
70 results.append(
71 {
72 "url": "https://metacpan.org/pod/" + module,
73 "title": module,
74 "content": fields.get("abstract", ""),
75 }
76 )
77
78 return results

Variable Documentation

◆ about

dict searx.engines.metacpan.about
Initial value:
1= {
2 "website": 'https://metacpan.org/',
3 "wikidata_id": 'Q841507',
4 "official_api_documentation": 'https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md',
5 "use_official_api": True,
6 "require_api_key": False,
7 "results": 'JSON',
8}

Definition at line 9 of file metacpan.py.

◆ categories

list searx.engines.metacpan.categories = ["it", "packages"]

Definition at line 20 of file metacpan.py.

◆ disabled

bool searx.engines.metacpan.disabled = True

Definition at line 21 of file metacpan.py.

◆ number_of_results

int searx.engines.metacpan.number_of_results = 20

Definition at line 19 of file metacpan.py.

◆ paging

bool searx.engines.metacpan.paging = True

Definition at line 23 of file metacpan.py.

◆ query_data_template

dict searx.engines.metacpan.query_data_template
Initial value:
1= {
2 'query': {
3 'multi_match': {
4 'type': 'most_fields',
5 'fields': ['documentation', 'documentation.*'],
6 'analyzer': 'camelcase',
7 }
8 },
9 'filter': {
10 'bool': {
11 'must': [
12 {'exists': {'field': 'documentation'}},
13 {'term': {'status': 'latest'}},
14 {'term': {'indexed': 1}},
15 {'term': {'authorized': 1}},
16 ]
17 }
18 },
19 "sort": [
20 {"_score": {"order": "desc"}},
21 {"date": {"order": "desc"}},
22 ],
23 '_source': ['documentation', "abstract"],
24 'size': number_of_results,
25}

Definition at line 25 of file metacpan.py.

◆ search_url

searx.engines.metacpan.search_url = urlunparse(["https", "fastapi.metacpan.org", "/v1/file/_search", "", "", ""])

Definition at line 50 of file metacpan.py.

◆ shortcut

str searx.engines.metacpan.shortcut = "cpan"

Definition at line 22 of file metacpan.py.