Proximity between more than 2 words


(Niv Margalit) #1

Hi,

If I write the query "fox brown"~5, i will get results in which those words are no more than 5 words apart.

Can I also write a query "fox brown fast"~5? If so, which results shall be returned?

Thanks,

Niv


(Christoph) #2

Hi,

Why not just try it out with some sample data? I just did and it seems like the slop factor (the ~5) account for the maximum number of other tokens allowed in the phrase (other than the ones specified in the query):

PUT /slop/test/1
{
  "text": "the fox one two three brown four five fast"
}

PUT /slop/test/2
{
  "text": "the fox one two three brown four five six fast"
}

GET /slop/test/_search
{
  "query": { "simple_query_string": {
    "query": "\"fox brown fast\"~5",
    "fields": ["text"]
  }}
}

==>

"hits": {
    "total": 1,
    "max_score": 0.27927625,
    "hits": [
      {
        "_index": "slop",
        "_type": "test",
        "_id": "4",
        "_score": 0.27927625,
        "_source": {
          "text": "the fox one two three brown four five fast"
        }
      }
    ]
  }

So the last query matches fox one two three brown four five fast (doc1) but not if you put six token enywhere inbetween tokens in the phrase


(Niv Margalit) #3

Hey,

Thanks for your answer.
I am researching this search engine, but unfortunately don't have it install on my machine.
Tried to install it, but it got complicated, so I thought I can get help here.


(Christoph) #4

You can get help installing it if you like :wink:


(Niv Margalit) #5

Thanks.
For my current needs, this was easier.
If I see I need further experiments I will ask for installation help :smiley:


(system) #6