diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..6f712c2
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+# Simple script to deploy to d-package-search.andrewlalis.com
+
+mvn clean package
+jarfile=$(find target/d-package-search-*.jar)
+echo "Built JAR: $jarfile"
+ssh -f root@andrewlalis.com 'systemctl stop d-package-search && rm -rf /opt/d-package-search/package-index'
+echo "Shut down d-package-search service."
+scp $jarfile root@andrewlalis.com:/opt/d-package-search/d-package-search.jar
+echo "Uploaded JAR."
+scp -r package-index root@andrewlalis.com:/opt/d-package-search/package-index
+echo "Uploaded package-index."
+ssh -f root@andrewlalis.com 'systemctl start d-package-search'
+echo "Started d-package-search service."
diff --git a/pom.xml b/pom.xml
index 119906b..24a6557 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,27 +42,29 @@
org.apache.maven.plugins
- maven-assembly-plugin
- 3.6.0
-
-
-
- com.andrewlalis.d_package_search.DPackageSearch
-
-
-
- jar-with-dependencies
-
-
+ maven-shade-plugin
+ 3.5.1
- make-assembly
package
- single
+ shade
+
+ true
+ false
+
+
+
+ com.andrewlalis.d_package_search.DPackageSearch
+ true
+
+
+
+
+
diff --git a/src/main/java/com/andrewlalis/d_package_search/impl/LucenePackageSearcher.java b/src/main/java/com/andrewlalis/d_package_search/impl/LucenePackageSearcher.java
index bdf6673..b414e0b 100644
--- a/src/main/java/com/andrewlalis/d_package_search/impl/LucenePackageSearcher.java
+++ b/src/main/java/com/andrewlalis/d_package_search/impl/LucenePackageSearcher.java
@@ -36,6 +36,11 @@ public class LucenePackageSearcher implements PackageSearcher {
"readme", 0.25f
);
+ /**
+ * The maximum number of results to show.
+ */
+ private static final int MAX_RESULTS = 10;
+
private final Path indexPath;
public LucenePackageSearcher(Path indexPath) {
@@ -49,8 +54,8 @@ public class LucenePackageSearcher implements PackageSearcher {
try (DirectoryReader dirReader = DirectoryReader.open(FSDirectory.open(indexPath))) {
IndexSearcher searcher = new IndexSearcher(dirReader, Executors.newVirtualThreadPerTaskExecutor());
- TopDocs topDocs = searcher.search(luceneQuery, 25, Sort.RELEVANCE, false);
- List results = new ArrayList<>(25);
+ TopDocs topDocs = searcher.search(luceneQuery, MAX_RESULTS, Sort.RELEVANCE, false);
+ List results = new ArrayList<>(MAX_RESULTS);
for (ScoreDoc scoreDoc : topDocs.scoreDocs) {
Document doc = searcher.storedFields().document(scoreDoc.doc);
results.add(prepareResult(