Skip to content

Search API returns irrelevant results #3187

Closed
@Pzixel

Description

@Pzixel

Describe the bug
When querying https://crates.io/api/v1/crates results are invalid sometimes

To Reproduce
Steps to reproduce the behavior:

A:

  1. Go to https://crates.io/api/v1/crates?page=1&per_page=20&q=rust_dec&sort=
  2. Observe that results page doesn't have a single rust_dec word, but it produces some irrelevant crates like aocleaderboard, atomic-traits and others

B:

  1. Go to https://crates.io/api/v1/crates?page=1&per_page=20&q=rust_dec
  2. Observe that results page contains rust_dec word, but it also produces some irrelevant crates like z3d, google_maps and others

Expected behavior
It should show the same result as https://crates.io/api/v1/crates?page=1&per_page=20&q=rust_deci&sort= query (note i in the end of the query):

{
   "crates":[
      {
         "id":"rust_decimal",
         "name":"rust_decimal",
         "updated_at":"2020-12-28T16:53:45.360679+00:00",
         "versions":null,
         "keywords":null,
         "categories":null,
         "badges":[
            
         ],
         "created_at":"2016-11-16T16:31:13.547828+00:00",
         "downloads":814045,
         "recent_downloads":210946,
         "max_version":"1.9.0",
         "newest_version":"1.9.0",
         "max_stable_version":"1.9.0",
         "description":"A Decimal Implementation written in pure Rust suitable for financial calculations.",
         "homepage":null,
         "documentation":"https://docs.rs/rust_decimal/",
         "repository":"https://github.com/paupino/rust-decimal",
         "links":{
            "version_downloads":"/api/v1/crates/rust_decimal/downloads",
            "versions":"/api/v1/crates/rust_decimal/versions",
            "owners":"/api/v1/crates/rust_decimal/owners",
            "owner_team":"/api/v1/crates/rust_decimal/owner_team",
            "owner_user":"/api/v1/crates/rust_decimal/owner_user",
            "reverse_dependencies":"/api/v1/crates/rust_decimal/reverse_dependencies"
         },
         "exact_match":false
      },
      {
         "id":"rust_decimal_macro_impls",
         "name":"rust_decimal_macro_impls",
         "updated_at":"2020-07-11T21:49:51.446673+00:00",
         "versions":null,
         "keywords":null,
         "categories":null,
         "badges":[
            
         ],
         "created_at":"2019-02-03T03:22:12.536585+00:00",
         "downloads":32018,
         "recent_downloads":1174,
         "max_version":"1.7.0",
         "newest_version":"1.7.0",
         "max_stable_version":"1.7.0",
         "description":"Shorthand macros to assist creating Decimal types. Do not depend on this directly; use rust_decimal_macros",
         "homepage":null,
         "documentation":"https://docs.rs/rust_decimal/",
         "repository":"https://github.com/paupino/rust-decimal",
         "links":{
            "version_downloads":"/api/v1/crates/rust_decimal_macro_impls/downloads",
            "versions":"/api/v1/crates/rust_decimal_macro_impls/versions",
            "owners":"/api/v1/crates/rust_decimal_macro_impls/owners",
            "owner_team":"/api/v1/crates/rust_decimal_macro_impls/owner_team",
            "owner_user":"/api/v1/crates/rust_decimal_macro_impls/owner_user",
            "reverse_dependencies":"/api/v1/crates/rust_decimal_macro_impls/reverse_dependencies"
         },
         "exact_match":false
      },
      {
         "id":"rust_decimal_macros",
         "name":"rust_decimal_macros",
         "updated_at":"2020-12-28T16:54:49.057667+00:00",
         "versions":null,
         "keywords":null,
         "categories":null,
         "badges":[
            
         ],
         "created_at":"2017-11-11T19:29:52.110872+00:00",
         "downloads":60126,
         "recent_downloads":21243,
         "max_version":"1.9.0",
         "newest_version":"1.9.0",
         "max_stable_version":"1.9.0",
         "description":"Shorthand macros to assist creating Decimal types.",
         "homepage":null,
         "documentation":"https://docs.rs/rust_decimal/",
         "repository":"https://github.com/paupino/rust-decimal",
         "links":{
            "version_downloads":"/api/v1/crates/rust_decimal_macros/downloads",
            "versions":"/api/v1/crates/rust_decimal_macros/versions",
            "owners":"/api/v1/crates/rust_decimal_macros/owners",
            "owner_team":"/api/v1/crates/rust_decimal_macros/owner_team",
            "owner_user":"/api/v1/crates/rust_decimal_macros/owner_user",
            "reverse_dependencies":"/api/v1/crates/rust_decimal_macros/reverse_dependencies"
         },
         "exact_match":false
      }
   ],
   "meta":{
      "total":3,
      "next_page":null,
      "prev_page":null
   }
}

Screenshots

image

Activity

changed the title [-]Search using API returns unappripriate results[/-] [+]Search API returns irrelevant results[/+] on Jan 18, 2021
added a commit that references this issue on Jan 25, 2021
Turbo87

Turbo87 commented on Jan 30, 2021

@Turbo87
Member

thanks for reporting this @Pzixel. I share your view that the search algorithm needs to be improved, though at the moment it is not clear for us yet exactly how we can improve it. We have a similar issue already reported at #2739, so I'll go ahead and close this one as a duplicate. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Turbo87@Pzixel

        Issue actions

          Search API returns irrelevant results · Issue #3187 · rust-lang/crates.io