calc fixes and update readme

This commit is contained in:
mat 2023-12-20 17:45:16 -06:00
parent 90b962e3b0
commit c7633f68c1
6 changed files with 27 additions and 3 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
/target
/deploy.sh

12
README
View File

@ -1 +1,13 @@
a cute metasearch engine
it sources from google, bing, brave, and a few others.
it's written in rust using no templating engine and with as little client-side
javascript as possible.
metasearch is a single binary with no cli or configuration file. if you want to
configure it (like to change the default port or weights of engines) then you
have to modify the source.
build it with `cargo b -r`, the resulting binary will be in `target/release/metasearch2`.
it runs on port 28019.

View File

@ -57,7 +57,10 @@ fn evaluate(query: &str, html: bool) -> Option<String> {
let mut result_html = String::new();
for span in result.get_main_result_spans() {
let class = match span.kind() {
fend_core::SpanKind::Number | fend_core::SpanKind::Boolean => "answer-calc-constant",
fend_core::SpanKind::Number
| fend_core::SpanKind::Boolean
| fend_core::SpanKind::Date => "answer-calc-constant",
fend_core::SpanKind::String => "answer-calc-string",
_ => "",
};
if !class.is_empty() {

View File

@ -1,5 +1,6 @@
// add a datalist after the search input
const searchInputEl = document.getElementById("search-input");
// add a datalist after the search input
const datalistEl = document.createElement("datalist");
datalistEl.id = "search-input-datalist";
searchInputEl.setAttribute("list", datalistEl.id);

View File

@ -137,3 +137,9 @@ h1 {
color: #d2a6ff;
white-space: pre;
}
.answer-calc-string {
color: #aad94c;
}
.answer-calc-special {
color: #e6b673;
}

View File

@ -5,7 +5,7 @@ use std::net::SocketAddr;
use axum::{http::header, routing::get, Router};
pub const BIND_ADDRESS: &str = "[::]:3000";
pub const BIND_ADDRESS: &str = "[::]:28019";
pub async fn run() {
let app = Router::new()