mirror of
https://github.com/modrinth/code.git
synced 2026-09-02 04:56:52 +00:00
fix tests
This commit is contained in:
@@ -483,7 +483,7 @@ mod tests {
|
|||||||
assert_eq!(filter.matches("$versions(").count(), 1);
|
assert_eq!(filter.matches("$versions(").count(), 1);
|
||||||
assert!(filter.contains("license:=`MIT`"));
|
assert!(filter.contains("license:=`MIT`"));
|
||||||
assert!(filter.contains(
|
assert!(filter.contains(
|
||||||
"categories:`fabric` && game_versions:1.20.1 || categories:`forge` && game_versions:1.21.1"
|
"categories:`fabric` && game_versions:`1.20.1` || categories:`forge` && game_versions:`1.21.1`"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -304,6 +304,8 @@ const fn default_max_candidates() -> usize {
|
|||||||
|
|
||||||
impl TypesenseConfig {
|
impl TypesenseConfig {
|
||||||
pub fn new(meta_namespace: Option<String>) -> Self {
|
pub fn new(meta_namespace: Option<String>) -> Self {
|
||||||
|
let use_cache = meta_namespace.is_none() && ENV.TYPESENSE_USE_CACHE;
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
url: ENV.TYPESENSE_URL.clone(),
|
url: ENV.TYPESENSE_URL.clone(),
|
||||||
api_key: ENV.TYPESENSE_API_KEY.clone(),
|
api_key: ENV.TYPESENSE_API_KEY.clone(),
|
||||||
@@ -312,7 +314,7 @@ impl TypesenseConfig {
|
|||||||
index_chunk_size: ENV.SEARCH_INDEX_CHUNK_SIZE,
|
index_chunk_size: ENV.SEARCH_INDEX_CHUNK_SIZE,
|
||||||
import_batch_size: ENV.TYPESENSE_IMPORT_BATCH_SIZE,
|
import_batch_size: ENV.TYPESENSE_IMPORT_BATCH_SIZE,
|
||||||
delete_batch_size: ENV.TYPESENSE_DELETE_BATCH_SIZE,
|
delete_batch_size: ENV.TYPESENSE_DELETE_BATCH_SIZE,
|
||||||
use_cache: ENV.TYPESENSE_USE_CACHE,
|
use_cache,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,12 @@ fn normalize_not(expression: FilterExpr) -> FilterExpr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn normalize_predicate(predicate: FilterPredicate) -> FilterExpr {
|
fn normalize_predicate(mut predicate: FilterPredicate) -> FilterExpr {
|
||||||
|
if let FilterCondition::In { values, .. } = &mut predicate.condition {
|
||||||
|
values.sort();
|
||||||
|
values.dedup();
|
||||||
|
}
|
||||||
|
|
||||||
if predicate.field.as_str() == "minecraft_java_server.ping.data"
|
if predicate.field.as_str() == "minecraft_java_server.ping.data"
|
||||||
&& let FilterCondition::Exists { negated } = predicate.condition
|
&& let FilterCondition::Exists { negated } = predicate.condition
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user