The following examples, which use an implementation of the TypeaheadSearch component, are used to test the ReconciliationAPI extension.
Parser function
{{#recon-sitesearch: |apiurl=(Base) URL of the API to get our data from |apiurlparams=Convenience method. Put each url parameter, e.g. action=recon-suggest-entity, on a new line. The URL encoding and ampersands are taken care of for you. Use the final parameter for the user-provided substring. // SUBJECT TO CHANGE! |targeturl=URL of the search page default? https://codecs.vanhamel.nl/index.php?title=Special%3ASearch&fulltext=0&search= |footerurl=URL of the query page to be used for the footer. The footer is typically used to send the user to a full-text query page |placeholder=Placeholder text, e.g. Search the website. |dev=true // Temporary. Set to anything but false to show the API being used and maybe some additional information. // For later consideration |showthumbnail=boolean |newwindow=false (default) or true // open link in same or new window when clicked. Cf. _blank or _new or |target=_blank or _new (open page in same or new window) }}
{{#recon-sitesearch: |apiurl=https://codecs.vanhamel.nl/api.php |apiurlparams=action=recon-suggest-entity origin=* profile=69723 substr= |targeturl=https://codecs.vanhamel.nl/Special:Search?fulltext=0&search= |footerurl=https://codecs.vanhamel.nl/Special:Search?fulltext=1&search= |dev=true }}
{{#recon-sitesearch: |apiurl=https://codecs.vanhamel.nl/api.php&action=recon-suggest-entity&origin=*&profile=69723&substr= |targeturl=https://codecs.vanhamel.nl/Special:Search?fulltext=0&search= |footerurl=https://codecs.vanhamel.nl/Special:Search?fulltext=1&search= |dev=true }}
Example 1: find manuscript
Search manuscripts, based on profile defined by CODECS (uses like: notation at the time of writing)
Target URL: https://codecs.vanhamel.nl/Special:Search?fulltext=0&search=
Footer URL: https://codecs.vanhamel.nl/Special:Search?fulltext=1&search=
- Code
{{#recon-sitesearch: |apiurl=https://codecs.vanhamel.nl/api.php |apiurlparams=action=recon-suggest-entity origin=* profile=69723 substr= |targeturl=https://codecs.vanhamel.nl/Special:Search?fulltext=0&search= |footerurl=https://codecs.vanhamel.nl/Special:Search?fulltext=1&search= |dev=true }}
Example 2: texts
Search texts, based on profile with id=69727
Target URL: https://codecs.vanhamel.nl/Special:Search?fulltext=0&search=
Footer URL: https://codecs.vanhamel.nl/Special:Search?fulltext=1&search=
Variant: using the special redirect service (Special:ReconRedirect), based on profile with ID = 69727. This profile contains settings used to check if the page was published according to 'Property:Is published'.
Target URL: https://codecs.vanhamel.nl/Special:ReconRedirect/69727?q=
Footer URL: https://dev.vanhamel.nl/index.php?title=Special:Search&fulltext=1&search=
Example 3: bibliographic records
Search the bibliography. An illustrative use case for 'allchars'.
Target URL: https://codecs.vanhamel.nl/Special:Search?search=
Footer URL: https://dev.vanhamel.nl/index.php?title=Special:Search&fulltext=1&search=
Example 4: agents
Target URL: https://codecs.vanhamel.nl/Special:Search?search=
Footer URL: https://dev.vanhamel.nl/index.php?title=Special:Search&fulltext=1&search=
Example 5: zoek wat lekkers
Using the present site instead. SMW is installed but does not use either FTS or ES.
- SMW
try Pepernoot (capitalised!) or marsepein
Target URL: https://dev.vanhamel.nl/Special:Search?search=
Footer URL: https://dev.vanhamel.nl/index.php?title=Special:Search&fulltext=1&search=
- Similar but using MW core, with images suggested by the PageImages extension
try Pepernoot or Marsepein
Target URL: https://dev.vanhamel.nl/Special:Search?search=
Footer URL: https://dev.vanhamel.nl/index.php?title=Special:Search&fulltext=1&search=
Example 6 - images
Using thumbnail images from Tionscadal na Nod.
Target URL: https://codecs.vanhamel.nl/Special:Search?fulltext=0&search=
Footer URL: https://codecs.vanhamel.nl/Special:Search?fulltext=1&search=
Example 7
If the wiki pages are pages in the File: namespace, it makes sense we include the associated images as thumbnails
Target URL: https://codecs.vanhamel.nl/Special:Search?fulltext=0&search=
Footer URL: https://codecs.vanhamel.nl/Special:Search?fulltext=1&search=
Example 8: using MW Core
- Currently relatively slow.
- Redirects can be consolidated through config setting. If enabled, try 'Aided Bressail' with a double s.
Target URL: https://codecs.vanhamel.nl/Special:Search?fulltext=0&search=
Footer URL: https://codecs.vanhamel.nl/Special:Search?fulltext=1&search=
Thoughts
Styling issues
Because we are using TypeaheadSearch, we also inherit the styling that comes with it. The margin is off, however, because the following CSS (probably from our skin) overrides Codex's styling.
@media screen { .mw-content-ltr ul, .mw-content-rtl .mw-content-ltr ul { margin: 0.3em 0 0 1.6em; padding: 0; }
Update: This has been corrected in our LESS styling.
On the todo list
The following is about the TypeaheadSearch widget, not the API as such.
Occasional flashes of content
Sometimes a menu is very briefly visible before it disappears. Typing too fast?
Clicking vs selecting with the cursor
There is a difference!
- up and down keys
There is a difference between the 'id' (the wiki page), the 'name' (label of the wiki page) and 'value' (user provided).
- Clicking a candidate from the menu seems to achieve, correctly, that the user is sent to a URL with the 'id' appended to it.
- BUT: when the user is presented with a menu containing multiple candidates and using the 'down' arrow of the keyboard to select one of these, what happens is this:
- the search input gets filled with the name of the 'candidate' (so that 'value' = 'name')
- Hit enter and you'll be sent to the page with the 'value' (= 'name') appended to the URL
- Superficially, the old behaviour looks this: using the up/down arrows is similar to selecting a 'candidate' and hitting enter will take you there, which is what we want. This is misleading though because in the old situation there was no distinction between 'id' and 'page'.