minor formatting cleanup

This commit is contained in:
Alexandra
2024-10-16 03:25:31 -06:00
parent 50d45b041b
commit fe6fdfad3d
5 changed files with 37 additions and 7 deletions

2
.env
View File

@@ -1,3 +1,3 @@
PORT=8062
FUZZY_LENIENCY=0.2
FUZZY_LENIENCY=0.6
DEBUG=0

View File

@@ -5,10 +5,10 @@ export default function fuzzySearch(fileArr, query){
const options = {
findAllMatches: true,
threshold: leniency,
ignoreLocation: true,
//ignoreLocation: true,
includeScore: true,
ignoreFieldNorm: true,
keys: ['name']
//ignoreFieldNorm: true,
keys: ['filename']
}
const fuse = new Fuse(fileArr, options)
return fuse.search(query)

View File

@@ -35,7 +35,9 @@ app.get('/', function(req, res) {
app.get('/search', function(req, res) {
let results = fuzzySearch(fileList, req.query.q)
console.log(results)
if(process.env.DEBUG = "1"){
console.log(results)
}
res.render('pages/index', {
page: 'results',
query: req.query.q,

View File

@@ -29,7 +29,7 @@ _ / / / _ /_/ /_ / _ / / __/ / / / /_
<tr>
<td>
<a href="<%= results[x].item.path %>">
<%= results[x].item.name %>
<%= results[x].item.filename %>
</a>
</td>
<td>
@@ -42,7 +42,7 @@ _ / / / _ /_/ /_ / _ / / __/ / / / /_
<%= results[x].item.date %>
</td>
<td>
<%= 1 - results[x].score %>%
<%= (1 - results[x].score).toFixed(2) %>%
</td>
</tr>
<% } %>

View File

@@ -14,4 +14,32 @@
background-color: #1c2020;
color: #fff!important;
}
a {
color: #FFFFFF;
text-decoration: none;
}
tr:hover td {
color: #FFFFFF;
background: #3D4351;
}
a:hover {
text-decoration: underline;
color: #FFFFFF;
}
td {
webkit-transition: background 300ms ease-in;
transition-behavior: normal;
transition-duration: 300ms;
transition-timing-function: ease-in;
transition-delay: 0s;
transition-property: background;
-moz-transition: background 300ms ease-in;
-ms-transition: background 300ms ease-in;
-o-transition: background 300ms ease-in;
transition: background 300ms ease-in;
transition-behavior: normal;
transition-duration: 300ms;
transition-timing-function: ease-in;
transition-delay: 0s;
}
</style>