Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ad99ffc
Give extra score if the query matches exactly or partially the name o…
edwood-grant Aug 11, 2025
579482d
Add an extra joined up token if there are more than one token in the …
edwood-grant Aug 11, 2025
d6fe2bc
Eliminate magic numbers. Fix linting.
edwood-grant Aug 11, 2025
6a92592
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Aug 12, 2025
9cc5655
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Aug 15, 2025
55e8041
Merge branch 'main' into italo_capasso/fix-2232-1556
leonardo-lemos Aug 26, 2025
09708fb
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Aug 30, 2025
0bd52c7
Merge branch 'main' into italo_capasso/fix-2232-1556
jeremypw Sep 8, 2025
7241da2
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Sep 12, 2025
6a41d19
Uncommented accidentally commented lines.
edwood-grant Sep 12, 2025
2c1a6a3
Fixed wrong assignment on id_down variable.
edwood-grant Sep 12, 2025
c6e21c9
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Sep 13, 2025
3e22de5
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Sep 17, 2025
f87209f
Reversed query equality statement for consistency
edwood-grant Sep 19, 2025
25a33ec
Use query_down variable instead of invoking the method
edwood-grant Sep 19, 2025
e33a58c
Use query_down variable instead of invoking the method
edwood-grant Sep 19, 2025
4a24cbe
Add extra spacing before an if
edwood-grant Sep 19, 2025
298ada5
Added extra spacing at end of if statement
edwood-grant Sep 19, 2025
f172b76
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Sep 20, 2025
3e547d8
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Oct 17, 2025
7ad395f
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Oct 23, 2025
c2ac0a7
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Oct 29, 2025
23e1bd5
Removed a unnecessary critical message
edwood-grant Oct 29, 2025
8678b15
Simplified joined query statement syntax
edwood-grant Oct 29, 2025
1c67f81
Merge branch 'elementary:main' into italo_capasso/fix-2232-1556
edwood-grant Oct 29, 2025
90f764f
Added comment to explain the joined token addition
edwood-grant Oct 30, 2025
3dca57a
Added comment to explain the query length multiplier in the score for…
edwood-grant Oct 30, 2025
86261d3
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Oct 30, 2025
890c01a
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Nov 2, 2025
7081f0c
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Nov 5, 2025
83952a6
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Nov 8, 2025
6096a14
Merge branch 'main' into italo_capasso/fix-2232-1556
edwood-grant Dec 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/Core/Package.vala
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public class AppCenterCore.Package : Object {
public const string RUNTIME_UPDATES_ID = "xxx-runtime-updates";
public const string LOCAL_ID_SUFFIX = ".appcenter-local";
public const string DEFAULT_PRICE_DOLLARS = "1";
public const uint EXACT_MATCH_SCORE = 100;
public const uint PARTIAL_MATCH_SCORE = 50;

public string uid { get; construct; }

Expand Down Expand Up @@ -599,8 +601,20 @@ public class AppCenterCore.Package : Object {
var query_score = component.search_matches (query);

if (query_score == 0) {
score = 0;
break;
var id_down = component.id.down ();
var name_down = component.name.down ();
var query_down = query.down ();

// Give extra score value if query is a substring
// or if it matches exactly the component name or id
if (query_down == name_down || query_down == id_down) {
query_score = EXACT_MATCH_SCORE * queries.length;
} else if (
name_down.contains (query_down) ||
id_down.contains (query_down)
) {
query_score = PARTIAL_MATCH_SCORE * queries.length;
}
}

score += query_score;
Expand Down
7 changes: 7 additions & 0 deletions src/Core/SearchEngine.vala
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ public class AppCenterCore.SearchEngine : Object {

public void search (string query, AppStream.Category? category) {
this.query = pool.build_search_tokens (query);
// If there are multiple tokens, add an aditional joined query token
if (this.query.length > 1) {
var joined_query = query.replace (" ", "");
critical (joined_query);
this.query.resize (this.query.length + 1);
this.query[this.query.length - 1] = joined_query;
}
this.category = category;
packages.items_changed (0, packages.n_items, packages.n_items);
}
Expand Down
Loading