textpattern / textpattern-plugins-website

Textpattern CMS Plugins website.
https://plugins.textpattern.com
GNU General Public License v2.0
7 stars 1 forks source link

expand searches #17

Closed colak closed 3 years ago

colak commented 4 years ago

Describe the issue When searching for plugins compatible to a particular txp version, no results are returned after making a selection from the pulldown but text field is empty.

To reproduce Steps to reproduce the behaviour:

  1. Go to homepage
  2. Click on the txp version pulldown and select one of them (leave search field empty)
  3. Click search

Expected behaviour A list of version specific plugins

philwareham commented 4 years ago

@bloke @bloatware is this achievable and OK to do? Default Textpattern behaviour is to not do a search when the search field is empty - we would need to change that behaviour here to show everything if the field is empty (and filter by custom fields, which we do in the results anyway).

Bloke commented 4 years ago

<txp:if_search> will fail if q= is empty but this code will pass the test whether q has content or not:

<txp:if_request name="q">
   YEP, haz request, content: <txp:page_url type="q" />
</txp:if_request>

So we could replace <txp:if_search> for the above and then deal with situations where q is empty slightly differently, perhaps with a <txp:evaluate test="page_url"> conditional.

bloatware commented 4 years ago

<txp:if_article_list type="q, compatibility" /> should work for search detection, but <txp:if_search_results /> require q be not empty.

philwareham commented 4 years ago

Sorry, I don't understand either of those two solutions - can somebody please amend the page code, which I guess starts around here: https://github.com/textpattern/textpattern-plugins-website/blob/master/src/templates/pages/default.txp#L106

Thanks.

bloatware commented 4 years ago

It should work now, please test.

Bloke commented 4 years ago

Neat! It works on the site but I can't see any change in the repo. Did you just change it directly on the site?

One thing we might be able to do in the search message at the top is add the compatibility info requested if it's anything other than 'any', and maybe hide the search term if it's not used. e.g.

<txp:search_result_count text="plugin(s) found" />
<txp:if_variable name="compatibility" not value="Any">
   compatible with Textpattern <txp:variable name="compatibility" />
</txp:if_variable>
<txp:evaluate test="search_term">matching your search request <q><txp:search_term /></q></txp:evaluate>.

Would that work?

bloatware commented 4 years ago

Oops! Sorry, I have changed the site directly. Yes, evaluate would work (even without test), or you could also use

<txp:search_term wraptag="matching your search request <q><+></q>" />
Bloke commented 4 years ago

Even better. I always forget about <+>.

bloatware commented 4 years ago

For the record, I have modified only default page.

Bloke commented 4 years ago

Oki doke. If you're done tinkering for now, I'll commit your changes to the repo.

Bloke commented 4 years ago

Can anyone unravel what's going on here?

Is it because there's no max-txp-version-verified for etc_pagination? Anything we can do about this? Or do we have to ensure that both min and max are set?

philwareham commented 4 years ago

Yes the search is for verified plugins, because that plugin hasn’t been verified yet it won’t show in search results. It’s the best I could do - not precious about it though, if you can improve it that’d be fine with me.

philwareham commented 4 years ago

Just looking at the code additions, curious about what this does?...

<txp:output_form yield="head, body_header, body_footer" />
bloatware commented 4 years ago

@philwareham preloads and caches these forms in one go, sparing 2 further db queries. Useless if queries are cached by db engine, in which case it's safe to remove.

bloatware commented 4 years ago

@Bloke @philwareham sorry, I have slightly modified default page of the site again (too lazy to setup my local copy). Just removed two pgonly queries, replacing them with variable store.

I have tried to update the repo too, please check.

philwareham commented 3 years ago

Done. Closing.