-
-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SMWSearch power profile form #3126
Conversation
@kghbln @s7eph4n This is a WIP and came as left-over while experimenting with ES on excerpts and score sorting. The power form adds some sorting Questions:
|
I believe that this is a nice feature especially for power-users or users who are desperate to find something a grab every straw to get something useful as results. Probably depending on the effort to make it happen.
I am wondering if this could "also" be piggy-backed to the "Advanced" tab like Translate and/or SIL are doing it. Apart from that "Extended" appears fine to me. |
Well, there is a side story to the "Advanced" tab which can be extended with a hook called The "Advanced" tab and @@ -269,17 +269,21 @@ class SearchFormWidget {
}
$showSections = [
'namespaceTables' => "<table>" . implode( '</table><table>', $namespaceTables ) . '</table>',
];
- Hooks::run( 'SpecialSearchPowerBox', [ &$showSections, $term, $opts ] );
+ Hooks::run( 'SpecialSearchPowerBox', [ &$showSections, $term, $opts, &$parameters ] );
$hidden = '';
foreach ( $opts as $key => $value ) {
$hidden .= Html::hidden( $key, $value );
}
+ foreach ( $parameters as $key => $value ) {
+ $this->specialSearch->setExtraParam( $key, $value );
+ } Above is not going to happen and your left with creating your own tab via |
I love it! Frankly, I am surprised that this is not a thing yet on the vanilla search.
Yes, if you ask me. I think modularity is great, but users are already complaining about the complexity of the installation. So until we have a better way of installing extensions I'd go for including it directly.
Would it be possible to not have it as a new profile, but as an additional option to all the other profiles? Sort order and search perimeter are orthogonal. |
I'd love to but see my comments on the issue that arises with public function newSpecialSearchPowerBox( &$showSections, $term, $opts, &$parameters ) {
$sort = $GLOBALS['wgRequest']->getVal( 'sort' );
$parameters['sort'] = '';
$html = '';
foreach ( [ 'foo' => 'Foo', 'bar' => 'Bar' ] as $key => $value ) {
$selected = '';
if ( $sort === $key ) {
$selected = 'selected';
$parameters['sort'] = $key;
}
$html .= "<option value='$key' $selected>$value</option>";
}
$showSections['smw-sort'] = '<select name="sort">' . $html . '</select>';
$parameters['profile'] = 'advanced';
} |
I understand that adding such profile is expedient for a user engagement, yet just having it for the sake of a sorting option seemed a bit exaggerated to justify the extra coding and hook complexity. So, I pulled my magic hat over the last couple of hours to make this profile a meaningful endeavour by helping users to find things quick and easy. Saying that means, the profile is adding a form builder that let users define what search fields are relevant and provide a better existential means for the profile. To keep complexity low and the interface lean, fields are conjunctive which means if you need an OR, use the big long input field at the top with the well known The form builder uses a JSON definition [0] to define what property fields are to be displayed and in which order, whether they should have value autocompletion support or not, and so forth. The builder will create a HTML form that has a responsive design factor and is without any dependency to any other extension. Why all this? SMW is mostly concerned with structured searches but combining them with a full-text search (as in case of ES) posses some challenges to find a simple interface. The complexity of It should enable users to provided different forms from within Form and definitionDefinition
Responsive formJSON
|
Were do you get all these cool ideas. Show me the place please. :) And the definition of the search templates is done in the "rule" namespace!? |
Wow! This is great! |
Perhaps "Structured" as in structured content. This will definitively make people curious even if they do not know what it means right away. |
First I had it as I didn't spent too much time on the JSON schema but you got one rudimentary with
Currently it is maintained with |
Placeholder page for the wikidocu: |
Great. Still I have to dig into the mechanics of the new rule system since I am currently not sure how to set up more than one search template per wiki.
Thus everyone can adapt. "Extended" is fine with me too. The future will tell if there are other suggestions out there for the default naming. I do not expect any though. |
Great. Still I have to dig into the mechanics of the new rule system since I
am currently not sure how to set up more than one search template per wiki.
```
{
"type": "SEARCH_FORM_DEFINITION_RULE",
"forms": {
"My first form": [ // ---> Form
"Property one",
"Property two"
],
"My second form": [ // ---> Form
"Property One",
{
"Property three": { // Field with extra attributes
"autocomplete": true
}
}
],
"My third form": [ // ---> Form
"Property Foo",
"Property Bar"
]
}
}
```
If you call a form "Open" then this will create a predefined output.
If I really have time I may make an discovery on the
`SEARCH_FORM_DEFINITION_RULE` type but for the now all form
definitions are expected to be hosted in
`Rule:Search-profile-form-definition`.
PS: Comment "// ..." should be removed from the real JSON.
…On 4/22/18, Karsten Hoffmeyer ***@***.***> wrote:
> First I had it as MediaWiki... but since you mentioned it, I created a new
> rule type and the definition is now expected at
> Rule:Search-profile-form-definition. The name is fixed, well you could go
> all willy nilly and search for all forms with the
> SEARCH_FORM_DEFINITION_RULE type but that's just too ...
Great. Still I have to dig into the mechanics of the new rule system since I
am currently not sure how to set up more than one search template per wiki.
> Currently it is maintained with "smw-search-profile": "Extended"
Thus everyone can adapt. "Extended" is fine with me too. The future will
tell if there are other suggestions out there for the default naming. I do
not expect any though.
--
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#3126 (comment)
|
https://sandbox.semantic-mediawiki.org/wiki/Rule:Search-profile-form-definition Knock yourself out: |
Thanks a lot for the kick-starting knock-out. 😄 |
This is great! |
You will be able to adapt locally. See this #3126 (comment).
That's MediaWiki core and SMW cannot do anything to help here. I had the same issue on one wiki and our solution was to hide the namespace selection completely via CSS for good. This is however not the desired solution for most wikis. :| Right now I cannot remember if I opened an issue on Phabricator or if I talked with one WMF employee about this referring to an existing issue on Phabricator. Currently I cannot point you to anything. I suggest to open an issue at Phabricator. The worst that can happen is that it gets duped to an existing issue. This however does not hurt since it tells people that there is interest in getting this improved. It will be cool if you could add me as CC to the task you created. Cheers and thanks! |
This PR is made in reference to: #1233
This PR addresses or contains:
smw
power form toSpecial:Search
for when$wgSearchType = 'SMWSearch';
is usedThis PR includes:
Fixes: #1233
Example