Skip to content
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

Sort by downloads doesn't #396

Closed
DanielKeep opened this issue Aug 3, 2016 · 12 comments
Closed

Sort by downloads doesn't #396

DanielKeep opened this issue Aug 3, 2016 · 12 comments

Comments

@DanielKeep
Copy link

Right now, https://crates.io/search?q=mmap&sort=downloads looks like this to me:

no-crates-io-thats-not-how-sorting-works

Either this is wrong, or I've taken a serious blow to the head and can't ordering anymore.

@alexcrichton
Copy link
Member

cc @lazypenguin

@rminderhoud
Copy link
Contributor

That's strange as it's working on my local build. Looks like the results aren't coming back sorted from the API endpoint (https://crates.io/api/v1/crates?page=1&per_page=10&q=log&sort=downloads). Was the target re-built in production?

@alexcrichton
Copy link
Member

Hm it should be yeah, maybe the sql query should be updated?

@rminderhoud
Copy link
Contributor

@alexcrichton I'm running Postgres 9.5.3 on my system, I see in the travis build it's using 9.3, is that the same for production? Would you be able to test this query against that database? Should help us narrow down the issue.

SELECT crates.* FROM crates,
                               plainto_tsquery('test') q,
                               ts_rank_cd(textsearchable_index_col, q) rank
          WHERE q @@ textsearchable_index_col
          ORDER BY name = 'test' DESC, rank DESC, crates.downloads DESC
          LIMIT 0 OFFSET 10;

@alexcrichton
Copy link
Member

Looks like Heroku is using Postgres 9.3.9 and that query itself doesn't return anything for me (LIMIT 0), but did you intend to test something else perhaps?

@rminderhoud
Copy link
Contributor

My mistake, left off a digit on the limit. I've tested the front end with npm start --proxy https://crates.io and no dice, so the issue lies within the backend code as npm run start:local correctly sorts the objects. Trying to eliminate some possibilities here

SELECT crates.* FROM crates,
                               plainto_tsquery('test') q,
                               ts_rank_cd(textsearchable_index_col, q) rank
          WHERE q @@ textsearchable_index_col
          ORDER BY name = 'test' DESC, rank DESC, crates.downloads DESC
          LIMIT 10 OFFSET 10;

@alexcrichton
Copy link
Member

Sure:

  id  |        name        | rank | downloads 
------+--------------------+------+-----------
 1498 | clap               |  2.3 |    184216
 5483 | alienlanguage      |  2.3 |        96
 2061 | compiletest_rs     |  1.9 |     27969
  654 | suffix             |  1.9 |      4403
 4341 | rotor-test         |  1.9 |       783
 2425 | stree_cmd          |  1.9 |       540
 5286 | fast_inv_sqrt      |  1.7 |       135
 3453 | modbus-test-server |  1.6 |       672
  868 | punkt              |  1.6 |       645
 3056 | ascii_set          |  1.6 |       553

@rminderhoud
Copy link
Contributor

Alex, do you mind confirming that this produces the correct sort before I submit a new pull request?

SELECT crates.* FROM crates,
                               plainto_tsquery('test') q,
                               ts_rank_cd(textsearchable_index_col, q) rank
          WHERE q @@ textsearchable_index_col
          ORDER BY name = 'test' DESC, crates.downloads DESC, rank DESC,
          LIMIT 10 OFFSET 10;

Thanks for the patience.

@alexcrichton
Copy link
Member

Oh yeah no worries, that generates:

│  id  |         name         | rank | downloads
│------+----------------------+------+----------
│ 1498 | clap                 |  2.3 |    184228
│  805 | nom                  |  0.4 |    160691
│  221 | rust-crypto          |  0.1 |    118499
│  102 | encoding_index_tests |  1.2 |     89635
│   70 | glutin               |  0.1 |     81530
│  196 | quickcheck           |  4.6 |     72530
│ 3119 | walkdir              |  0.4 |     59235
│  534 | deque                |  0.1 |     58326
│  426 | websocket            |  1.3 |     49056
│ 4519 | mempool              |  0.6 |     48401

@Keats
Copy link

Keats commented Dec 6, 2016

Going to https://crates.io/search?q=markdown&sort=downloads it looks like it's still working correctly?

I see the following:
2016-12-06-162728_940x785_scrot

@carols10cents
Copy link
Member

Going to https://crates.io/search?q=markdown&sort=downloads it looks like it's still working correctly?

I see the following:

@Keats I think what you're seeing is that there's a crate with the exact name that matches your query, and crates.io is ALWAYS putting that one first. This could be made clearer, want to file a new issue for that?

@Keats
Copy link

Keats commented Dec 13, 2016

@carols10cents Done in #493

bors added a commit that referenced this issue Dec 18, 2019
…r-7.0.0, r=Turbo87

Bump ember-resolver from 4.2.4 to 7.0.0

Bumps [ember-resolver](https://github.com/ember-cli/ember-resolver) from 4.2.4 to 7.0.0.
<details>
<summary>Release notes</summary>

*Sourced from [ember-resolver's releases](https://github.com/ember-cli/ember-resolver/releases).*

> ## v7.0.0
> #### 💥 Breaking Change
> * [#452](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/452) Remove dead module unification code ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> #### 🚀 Enhancement
> * [#450](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/450) remove now defunct v8 optimization ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> #### 🐛 Bug Fix
> * [#475](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/475) Fix babel-plugin-debug-macros warning ([@&#8203;hjdivad](https://github.com/hjdivad))
>
> #### Committers: 2
> - David J. Hamilton ([@&#8203;hjdivad](https://github.com/hjdivad))
> - Stefan Penner ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
>
> ## v6.0.2
> * Re-release v6.0.0, to avoid SemVer issue with removal of module unification support within 6.x.
>
> ## Release 6.0.1
> #### 💥 Breaking Change
> * [#452](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/452) Remove dead module unification code ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> #### 🚀 Enhancement
> * [#450](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/450) remove now defunct v8 optimization ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> #### 🐛 Bug Fix
> * [#475](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/475) Fix babel-plugin-debug-macros warning ([@&#8203;hjdivad](https://github.com/hjdivad))
>
> #### Committers: 2
> - David J. Hamilton ([@&#8203;hjdivad](https://github.com/hjdivad))
> - Stefan Penner ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> ## Release 5.3.0
> ## v5.3.0 (2019-09-24)
>
> #### 🚀 Enhancement
> * [#417](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/417) Add support for nested colocated components. ([@&#8203;rwjblue](https://github.com/rwjblue))
>
> #### Committers: 1
> - Robert Jackson ([@&#8203;rwjblue](https://github.com/rwjblue))
>
> ## Release 5.2.1
> ## v5.2.1 (2019-08-09)
>
> #### 🐛 Bug Fix
> * [#396](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/396) Component and their templates should be normalized the same. ([@&#8203;rwjblue](https://github.com/rwjblue))
>
> #### Committers: 1
> - Robert Jackson ([@&#8203;rwjblue](https://github.com/rwjblue))
>
></tr></table> ... (truncated)
</details>
<details>
<summary>Changelog</summary>

*Sourced from [ember-resolver's changelog](https://github.com/ember-cli/ember-resolver/blob/master/CHANGELOG.md).*

> ## v7.0.0 (2019-12-18)
>
> #### 💥 Breaking Change
> * [#452](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/452) Remove dead module unification code ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> #### 🚀 Enhancement
> * [#450](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/450) remove now defunct v8 optimization ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> #### 🐛 Bug Fix
> * [#475](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/475) Fix babel-plugin-debug-macros warning ([@&#8203;hjdivad](https://github.com/hjdivad))
>
> #### Committers: 2
> - David J. Hamilton ([@&#8203;hjdivad](https://github.com/hjdivad))
> - Stefan Penner ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> ## v6.0.2 (2019-12-18)
>
> * Re-release v6.0.0, to avoid SemVer issue with removal of module unification support within 6.x.
>
> ## v6.0.1 (2019-12-18)
>
> #### 💥 Breaking Change
> * [#452](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/452) Remove dead module unification code ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> #### 🚀 Enhancement
> * [#450](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/450) remove now defunct v8 optimization ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> #### 🐛 Bug Fix
> * [#475](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/475) Fix babel-plugin-debug-macros warning ([@&#8203;hjdivad](https://github.com/hjdivad))
>
> #### Committers: 2
> - David J. Hamilton ([@&#8203;hjdivad](https://github.com/hjdivad))
> - Stefan Penner ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> ## v6.0.0 (2019-11-19)
>
> #### 💥 Breaking Change
> * [#449](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/449) Upgrade deps and drop node 6 support ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> #### Committers: 1
> - Stefan Penner ([@&#8203;stefanpenner](https://github.com/stefanpenner))
>
> ## v5.2.1 (2019-08-09)
>
> #### 🐛 Bug Fix
> * [#396](https://github-redirect.dependabot.com/ember-cli/ember-resolver/pull/396) Component and their templates should be normalized the same. ([@&#8203;rwjblue](https://github.com/rwjblue))
>
> #### Committers: 1
> - Robert Jackson ([@&#8203;rwjblue](https://github.com/rwjblue))
>
></tr></table> ... (truncated)
</details>
<details>
<summary>Commits</summary>

- [`9593829`](ember-cli/ember-resolver@9593829) 7.0.0
- [`be2c61a`](ember-cli/ember-resolver@be2c61a) Add v7.0.0 to CHANGELOG.md.
- [`8f3c5fd`](ember-cli/ember-resolver@8f3c5fd) Add v6.0.2 to CHANGELOG.md.
- [`5f07661`](ember-cli/ember-resolver@5f07661) Bump resolve from 1.13.1 to 1.14.0
- [`abbbd08`](ember-cli/ember-resolver@abbbd08) Release 6.0.1
- [`6073445`](ember-cli/ember-resolver@6073445) Add automated release setup.
- [`e68934d`](ember-cli/ember-resolver@e68934d) Merge pull request [#475](https://github-redirect.dependabot.com/ember-cli/ember-resolver/issues/475) from ember-cli/hjdivad/remove-warnings
- [`27e393f`](ember-cli/ember-resolver@27e393f) Fix babel-plugin-debug-macros warning
- [`d948272`](ember-cli/ember-resolver@d948272) Bump @ember/optional-features from 1.1.0 to 1.2.0
- [`37dba53`](ember-cli/ember-resolver@37dba53) Bump eslint-plugin-ember from 7.7.1 to 7.7.2
- Additional commits viewable in [compare view](ember-cli/ember-resolver@v4.2.4...v7.0.0)
</details>
<br />

[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=ember-resolver&package-manager=npm_and_yarn&previous-version=4.2.4&new-version=7.0.0)](https://dependabot.com/compatibility-score.html?dependency-name=ember-resolver&package-manager=npm_and_yarn&previous-version=4.2.4&new-version=7.0.0)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in the `.dependabot/config.yml` file in this repo:
- Update frequency
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants