Skip to content

Commit

Permalink
feat(annim): count in tracks query
Browse files Browse the repository at this point in the history
  • Loading branch information
Yesterday17 committed Sep 5, 2024
1 parent c1fd58a commit 1721419
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion anni/src/subcommands/repo/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ use std::collections::HashMap;

#[derive(Args, Debug, Clone)]
pub struct RepoMigrateAction {
#[clap(long)]
auth: String,

endpoint: String,
}

#[handler(RepoMigrateAction)]
async fn repo_migrate(me: RepoMigrateAction, manager: RepositoryManager) -> anyhow::Result<()> {
let repo = manager.into_owned_manager()?;
let client = AnnimClient::new(me.endpoint, Some("114514"));
let client = AnnimClient::new(me.endpoint, Some(&me.auth));

// insert tags
let mut ids = HashMap::new();
Expand Down
3 changes: 2 additions & 1 deletion annim/src/graphql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,14 @@ impl MetadataQuery {
&self,
ctx: &Context<'ctx>,
keyword: String,
count: usize,
) -> anyhow::Result<Vec<TrackSearchResult>> {
let search_manager = ctx.data::<RepositorySearchManager>().unwrap();

let query = search_manager.query_parser().parse_query(&keyword)?;
let searcher = search_manager.searcher();

let top_docs = searcher.search(&*query, &TopDocs::with_limit(10))?;
let top_docs = searcher.search(&*query, &TopDocs::with_limit(count))?;

let result: Vec<_> = top_docs
.into_iter()
Expand Down

0 comments on commit 1721419

Please sign in to comment.