Skip to content

Commit

Permalink
Fix pageSize property in Collections not using persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Mar 11, 2023
1 parent 5841141 commit 2e556c5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ See [STATUS.md](server/STATUS.md) to learn more about which features will remain
## UNRELEASED

- Remove `tpf` queries from `atomic-cli` #610
- Fix `pageSize` property in Collections not using persistence

## [v0.34.2] - 2023-03-04

Expand Down
2 changes: 0 additions & 2 deletions lib/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//! Functions for interacting with an Atomic Server
use url::Url;

use crate::{
agents::Agent,
commit::sign_message,
Expand Down
3 changes: 3 additions & 0 deletions lib/src/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ pub fn construct_collection_from_params(
if let Ok(val) = resource.get(urls::COLLECTION_PROPERTY) {
property = Some(val.to_string());
}
if let Ok(val) = resource.get(urls::COLLECTION_PAGE_SIZE) {
page_size = val.to_int()?.try_into().unwrap_or(DEFAULT_PAGE_SIZE);
}
if let Ok(val) = resource.get(urls::COLLECTION_VALUE) {
value = Some(val.to_string());
}
Expand Down
8 changes: 5 additions & 3 deletions server/src/handlers/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ pub struct SearchQuery {
pub limit: Option<usize>,
/// Only include resources that have this resource as its ancestor
pub parent: Option<String>,
/// Filter based on props, using tantivy QueryParser syntax
pub filter: Option<String>,
/// Filter based on props, using tantivy QueryParser syntax.
/// e.g. `prop:val` or `prop:val~1` or `prop:val~1 AND prop2:val2`
/// See https://docs.rs/tantivy/latest/tantivy/query/struct.QueryParser.html
pub filters: Option<String>,
}

const DEFAULT_RETURN_LIMIT: usize = 30;
Expand Down Expand Up @@ -160,7 +162,7 @@ fn query_from_params(
query_list.push((Occur::Must, Box::new(text_query)));
}

if let Some(filter) = &params.filter {
if let Some(filter) = &params.filters {
let filter_query = BoostQuery::new(
build_filter_query(fields, filter, &appstate.search_state.index)?,
20.0,
Expand Down

0 comments on commit 2e556c5

Please sign in to comment.