forked from MapComplete/MapComplete
Typing: make options optional in wikidata search
This commit is contained in:
parent
5f04a69517
commit
665f8b1d25
1 changed files with 3 additions and 3 deletions
|
@ -159,7 +159,7 @@ export default class Wikidata {
|
||||||
*/
|
*/
|
||||||
public static async searchAdvanced(
|
public static async searchAdvanced(
|
||||||
text: string,
|
text: string,
|
||||||
options: WikidataAdvancedSearchoptions
|
options?: WikidataAdvancedSearchoptions
|
||||||
): Promise<
|
): Promise<
|
||||||
{
|
{
|
||||||
id: string
|
id: string
|
||||||
|
@ -185,7 +185,7 @@ export default class Wikidata {
|
||||||
?num wikibase:apiOrdinal true .
|
?num wikibase:apiOrdinal true .
|
||||||
bd:serviceParam wikibase:limit ${
|
bd:serviceParam wikibase:limit ${
|
||||||
Math.round(
|
Math.round(
|
||||||
(options.maxCount ?? 20) * 1.5
|
(options?.maxCount ?? 20) * 1.5
|
||||||
) /*Some padding for disambiguation pages */
|
) /*Some padding for disambiguation pages */
|
||||||
} .
|
} .
|
||||||
?label wikibase:apiOutput mwapi:label .
|
?label wikibase:apiOutput mwapi:label .
|
||||||
|
@ -193,7 +193,7 @@ export default class Wikidata {
|
||||||
}
|
}
|
||||||
${instanceOf}
|
${instanceOf}
|
||||||
${minusPhrases.join("\n ")}
|
${minusPhrases.join("\n ")}
|
||||||
} ORDER BY ASC(?num) LIMIT ${options.maxCount ?? 20}`
|
} ORDER BY ASC(?num) LIMIT ${options?.maxCount ?? 20}`
|
||||||
const url = wds.sparqlQuery(sparql)
|
const url = wds.sparqlQuery(sparql)
|
||||||
|
|
||||||
const result = await Utils.downloadJson(url)
|
const result = await Utils.downloadJson(url)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue