Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thesuzerain committed Dec 2, 2023
1 parent 1963200 commit f7ddb7d
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 193 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

2 changes: 1 addition & 1 deletion src/models/v2/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl LegacyResultSearchProject {
slug: result_search_project.slug,
author: result_search_project.author,
title: result_search_project.name,
description: result_search_project.description,
description: result_search_project.summary,
display_categories,
downloads: result_search_project.downloads,
follows: result_search_project.follows,
Expand Down
11 changes: 5 additions & 6 deletions src/models/v3/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ impl Project {
.map(|x| GalleryItem {
url: x.image_url,
featured: x.featured,
title: x.title,
name: x.name,
description: x.description,
created: x.created,
ordering: x.ordering,
Expand All @@ -329,12 +329,11 @@ impl Project {
slug: m.slug,
project_types: m.project_types,
games,
team: team_id,
team_id,
organization: organization_id,
title: m.title,
description: m.description,
body: "".to_string(), // Body is potentially huge, do not store in search
body_url: None, // Deprecated
name: m.name,
summary: m.summary,
description: "".to_string(), // Body is potentially huge, do not store in search
published,
updated,
approved,
Expand Down
2 changes: 1 addition & 1 deletion src/search/indexing/local_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub async fn index_local(
version_id: version_id.to_string(),
project_id: project_id.to_string(),
name: m.inner.name.clone(),
description: m.inner.description.clone(),
summary: m.inner.summary.clone(),
categories,
follows: m.inner.follows,
downloads: m.inner.downloads,
Expand Down
4 changes: 2 additions & 2 deletions src/search/indexing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const DEFAULT_DISPLAYED_ATTRIBUTES: &[&str] = &[
"slug",
"author",
"name",
"description",
"summary",
"categories",
"display_categories",
"downloads",
Expand Down Expand Up @@ -223,7 +223,7 @@ const DEFAULT_DISPLAYED_ATTRIBUTES: &[&str] = &[
"loaders", // search uses loaders as categories- this is purely for the Project model.
];

const DEFAULT_SEARCHABLE_ATTRIBUTES: &[&str] = &["name", "description", "author", "slug"];
const DEFAULT_SEARCHABLE_ATTRIBUTES: &[&str] = &["name", "summary", "author", "slug"];

const DEFAULT_ATTRIBUTES_FOR_FACETING: &[&str] = &[
"categories",
Expand Down
4 changes: 2 additions & 2 deletions src/search/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub struct UploadSearchProject {
pub slug: Option<String>,
pub author: String,
pub name: String,
pub description: String,
pub summary: String,
pub categories: Vec<String>,
pub display_categories: Vec<String>,
pub follows: i32,
Expand Down Expand Up @@ -137,7 +137,7 @@ pub struct ResultSearchProject {
pub slug: Option<String>,
pub author: String,
pub name: String,
pub description: String,
pub summary: String,
pub categories: Vec<String>,
pub display_categories: Vec<String>,
pub downloads: i32,
Expand Down
4 changes: 2 additions & 2 deletions tests/common/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub async fn setup_search_projects(test_env: &TestEnvironment<ApiV3>) -> Arc<Has
let modify_json = serde_json::from_value(json!([
{ "op": "add", "path": "/categories", "value": DUMMY_CATEGORIES[0..2] },
{ "op": "add", "path": "/initial_versions/0/server_only", "value": true },
{ "op": "add", "path": "/title", "value": "Mysterious Project" },
{ "op": "add", "path": "/name", "value": "Mysterious Project" },
]))
.unwrap();
project_creation_futures.push(create_async_future(
Expand All @@ -99,7 +99,7 @@ pub async fn setup_search_projects(test_env: &TestEnvironment<ApiV3>) -> Arc<Has
{ "op": "add", "path": "/categories", "value": DUMMY_CATEGORIES[0..3] },
{ "op": "add", "path": "/initial_versions/0/server_only", "value": true },
{ "op": "add", "path": "/initial_versions/0/game_versions", "value": ["1.20.4"] },
{ "op": "add", "path": "/title", "value": "Mysterious Project" },
{ "op": "add", "path": "/name", "value": "Mysterious Project" },
{ "op": "add", "path": "/license_id", "value": "LicenseRef-All-Rights-Reserved" },
]))
.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions tests/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,9 +1119,9 @@ async fn align_search_projects() {
.await;
let mut project_model: Project = test::read_body_json(project_model).await;

// Body is huge- don't store it in search, so it's OK if they differ here
// Body/description is huge- don't store it in search, so it's OK if they differ here
// (Search should return "")
project_model.body = "".into();
project_model.description = "".into();

// Aggregate project loader fields will not match exactly,
// because the search will only return the matching version, whereas the project returns the aggregate.
Expand Down

0 comments on commit f7ddb7d

Please sign in to comment.