Compile
cargo build --target wasm32-wasi --release
By default, the WASM file will be in ./target/wasm32-wasi/release/sonic_search_wasm.wasm
Run
wasmedge --dir .:<path_to_all_lists> <path_to_wasm_file> -a <sonic_server_address_IPv4> -p <sonic_server_password> -c <email_collection> -f <filename_with_ingested_files> -g <http_server_ddress_gui>
Example
wasmedge --dir .:../../crabmailResult/ ./target/wasm32-wasi/release/sonic_search_wasm.wasm
*sonic_server_address must be IPv4 due to the fact that wasmedge_wasi_socket does not support IPv6 yet.
Bash script you can run instead of writing the whole command
#!/bin/bash
# Variables
path_to_all_lists="../../crabmailResult/"
path_to_wasm_file="./target/wasm32-wasi/release/sonic_search_wasm.wasm"
sonic_server_address_ipv4="127.0.0.1:5041"
sonic_server_password="SecretPassword"
email_collection="mailbox"
filename_with_ingested_files=".sonicSearchIngested.txt"
http_server_address_gui="127.0.0.1:3030"
# Run the wasmedge command
wasmedge --dir .:$path_to_all_lists $path_to_wasm_file -a $sonic_server_address_ipv4 -p $sonic_server_password -c $email_collection -f $filename_with_ingested_files -g $http_server_address_gui