2021-06-07T06:54:35+00:00
I came across the word slop
on this issue of the tantivy search engine built in rust. I googled and found this link . So, to explore it by doing, I performed these steps on Ubuntu 18.04 -
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.13.1
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.13.1
Added a document to elastic search
curl -H "Content-Type: application/json" -XPUT 127.0.0.1:9200/store -d '
{
"mappings": {
"properties" : {
"type": { "type": "keyword" },
"name": { "type": "text"},
"price": { "type": "double"},
"quantity": { "type": "integer"},
"department": { "type": "keyword"}
}
}
}
'
curl -H "Content-Type: application/json" -POST 127.0.0.1:9200/store/_doc/ -d '
{
"type": "products",
"name": "milk 1 gallon vanill soy",
"price": "8.99",
"quantity": "4",
"department": "Packaged Foods"
}
'
1 gallon milk
, used this query
curl -H "Content-Type: application/json" -XGET 127.0.0.1:9200/store/_search?pretty -d '{
"query": {
"match_phrase": {
"name": { "query": "1 gallon milk"}
}}}
'
1 gallon soy milk
added slop:1
curl -H "Content-Type: application/json" -XGET 127.0.0.1:9200/store/_search?pretty -d '{
"query": {
"match_phrase": {
"name": { "query": "1 gallon milk", "slop":1}
}}}
'
1 gallon vanilla soy milk
and 1 milk gallon vanilla soy
, add slop:2milk 1 gallon vanill soy
, add slop:3