Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
D
Distributed-Search-Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tammam.alsoleman
Distributed-Search-Engine
Commits
c6b4dc19
Commit
c6b4dc19
authored
Jan 21, 2026
by
tammam.alsoleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Edit to return the result to the front
parent
1660c00d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
SearchClient.java
src/main/java/com/distributed/search/grpc/SearchClient.java
+4
-8
No files found.
src/main/java/com/distributed/search/grpc/SearchClient.java
View file @
c6b4dc19
...
@@ -46,10 +46,9 @@ public class SearchClient {
...
@@ -46,10 +46,9 @@ public class SearchClient {
/**
/**
* Orchestrates the 2-Phase Distributed Search.
* Orchestrates the 2-Phase Distributed Search.
*/
*/
public
void
performSearch
(
List
<
String
>
terms
,
List
<
String
>
allFiles
)
{
public
List
<
SearchResponse
.
DocumentResult
>
performSearch
(
List
<
String
>
terms
,
List
<
String
>
allFiles
)
{
if
(
stubs
.
isEmpty
())
{
if
(
stubs
.
isEmpty
())
{
System
.
out
.
println
(
"No workers available."
);
return
Collections
.
emptyList
();
return
;
}
}
// Phase 1: Aggregate Global Counts
// Phase 1: Aggregate Global Counts
...
@@ -103,11 +102,8 @@ public class SearchClient {
...
@@ -103,11 +102,8 @@ public class SearchClient {
currentFileIndex
+=
count
;
currentFileIndex
+=
count
;
}
}
// ---
Sort and Show Top 10
---
// ---
return the sorted list
---
finalResults
.
sort
((
a
,
b
)
->
Double
.
compare
(
b
.
getScore
(),
a
.
getScore
()));
finalResults
.
sort
((
a
,
b
)
->
Double
.
compare
(
b
.
getScore
(),
a
.
getScore
()));
System
.
out
.
println
(
"\n--- Search Results ---"
);
return
finalResults
;
for
(
int
i
=
0
;
i
<
Math
.
min
(
10
,
finalResults
.
size
());
i
++)
{
System
.
out
.
println
((
i
+
1
)
+
". "
+
finalResults
.
get
(
i
).
getDocumentName
()
+
" (Score: "
+
finalResults
.
get
(
i
).
getScore
()
+
")"
);
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment