Making WordPress.org

Change History (9)

#1 @obenland
10 years ago

The API uses a regular BB_Query to get its search results. These results are then checked for exact matches to be bumped to the top. In cases where the exact match happens to be on a subsequent page, that bumping obviously can't take place - leading to the unexpected result.

Unfortunately there is no great solution to this problem. We could ignore the per_page and page argument for search queries and do paging after the results were bumped, which would help in the case of P2 and maybe Responsive. But if there happens to be a theme called Black that is close to two years old, it will be buried under newer themes that might have the word "black" in their description.

#2 @danielbachhuber
10 years ago

What changed recently to cause this to break?

#3 @obenland
10 years ago

  • Cc otto42 added

This: https://core.trac.wordpress.org/ticket/31115

The commit message reads:

Remove the overriding of the order_by for the API requests. The existing themes directory has its own code to handle the ordering, and this override was causing bad results by forcing only highest rated themes to the top, rather than best matching themes. The results now should match in the theme directories results on the site and in the returned responses.

#4 @Otto42
10 years ago

That didn't break this, that fixed a completely different problem.

The underlying issue is indeed that if you set the per-page results too low, then the expected theme won't be in the first page of results, and so it cannot be pushed to the top. So, don't set the per-page results that low. Nothing in core does that.

In the long run, this might be fixed by the new theme directory and new functionality in the API to use that directory (using WP_Query and such), but for now, per_page should probably never be lower than 8 or 10 or so. Core queries expect 30 per-page, I think.

#5 @Otto42
10 years ago

Also, the result for the per_page = 1 is not an invalid result. You're not asking for info about "p2" here, you're searching for it. The mercury theme is one of those search results. The breakage lies in the re-ordering that fails to properly occur when the per-page is set too low.

#6 @danielbachhuber
10 years ago

The underlying issue is indeed that if you set the per-page results too low, then the expected theme won't be in the first page of results, and so it cannot be pushed to the top. So, don't set the per-page results that low. Nothing in core does that.

Er, this seems like an API bug to me, not user error.

The breakage lies in the re-ordering that fails to properly occur when the per-page is set too low.

Right. It's a bug in the API.

If it's not a priority to fix, you can say that. I've come up with an alternative for now. I don't think calling it user error is appropriate in this regard though.

#7 @Otto42
10 years ago

I didn't say it was user error. I was telling you how to workaround it, and why we don't see it in any of the normal queries.

#8 @obenland
7 years ago

  • Keywords reporter-feedback added

Is this still an issue? The output of all three queries seem fine?

#9 @danielbachhuber
7 years ago

  • Keywords reporter-feedback removed
  • Resolution set to invalid
  • Status changed from new to closed

I don't recall the original cause well-enough to confirm the issue is fixed 100% but the API response used to be incorrect and is now fixed.

Note: See TracTickets for help on using tickets.