Page MenuHomePhabricator

Add a link output format to inline queries
Closed, ResolvedPublic

Description

Author: jwm

Description:
link format for inline queries

Hello from earthquake ravaged Christchurch!

This patch adds a new inline query output format to the core which produces a link to the query's equivalent Special:Ask page, much the same as the “further results” link.

Use cases are to create additional “further results” links that use different output formats (eg calendar or event line for blogs), or to link to a query that shows all pages with a particular property on that property — think delicious/technorati style blog tags.

The code is pretty simple; it just copies paramaters straight into a link object for display, using the linkformat parameter to set the actual format of the linked-to search page.

The patch was made between 1.5.5.1 and current SVN, but I stripped any irrelevant changes between them, especially in the messages code.

Needs a help page; I'll write one if you want to use the patch.


Version: unspecified
Severity: enhancement

Attached:

Details

Reference
bz27638

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:29 PM
bzimport set Reference to bz27638.

Hi -- hope you are doing well down there, and that software is the only thing that needs patching in your immediate vicinity!

I wonder how the function you propose is different from running #ask with limit=-1. This should exactly do what you suggest: produce a further result link without even running the query, and passing all parameters on as other further results would do. Note that limit=0 runs the query and displays only if there is some result at all.

jwm wrote:

Ah, didn't know about that functionality. I'll test it out.

jwm wrote:

Yes, that does pretty much what I want, so maybe this is just a documentation bug after all :-)

Minor difference: the search page will use it's default limit, as you can't supply one if you're setting limit=-1.

I'll look at making some edits to the wiki docs to make it more obvious how to achieve this result.

Would I be right in assuming that setting searchlabel empty is a good way to suppress the further results link if you don't want one?

(In reply to comment #3)

...
Would I be right in assuming that setting searchlabel empty is a good way to
suppress the further results link if you don't want one?

Yes

jwm wrote:

On further examination, I have to say it doesn't work. The code path that produces a link in the limit < 0 case doesn't preserve parameters, so you get vanilla broadtable results:

http://semantic-mediawiki.org/wiki/User:Jwm/Minus_One_Limit_Bug

Further more, several result formats in the Semantic Result Formats override the
getResult method to print something even if there are no results, so they never produce a link.

I think the solution to the problem might be to fix getResult to produce the correct link, and have a flag to produce output for the no results, not limit<0 case — but it's starting to look like the limit special case method is harder to maintain than an explicit link result format.

jwm wrote:

Fixed by #27885

*** This bug has been marked as a duplicate of bug 27885 ***