dainiusjocas / lucene-grep

Grep-like utility based on Lucene Monitor compiled with GraalVM native-image
Apache License 2.0
190 stars 5 forks source link

Feat/streamed execution of queries #165

Closed dainiusjocas closed 2 years ago

dainiusjocas commented 2 years ago

Start lmgrep process once and wait for the input from STDIN that includes both: text and the query. Using such a technique avoids the "cold start" issues when the query is known only when the text is known.

Example:

echo '{"query": "nike~", "text": "I am selling nikee"}' | ./lmgrep --streamed --with-score --format=json --query-parser=simple
#=> {"line-number":1,"line":"I am selling nikee","score":0.09807344}

Is equivalent to:

echo  "I am selling nikee" | ./lmgrep --query="nike~" --with-score --format=json --query-parser=simple
#=> {"line-number":1,"line":"I am selling nikee","score":0.09807344}