This operator is used to specify that you would like results that have two (or more words) within a certain distance.
For example, I would like to get some information that talks about medicine for sore throats. In this case I would like the three words medicine, sore and throat to be present in the article.
My query could be:
medicine AND sore AND throat
When I run this query, I will get some articles like the one below. It's true that my three words are in the article, but, as they are not in the same paragraph, the article isn't relevant for me. In fact, it's more about vaccination than medicine.
To indicate that I would like the words to be close together in the article, I can use ~ or tilde.
My query is now:
"medicine sore throat"~10
This query brings me back this article:
Making Tilde Work
Use " " to group the words
Put the words you would like to find close to each other inside quotation marks.
What does the number mean?
The number refers to the maximum possible distance between the keywords. The exact meaning of the number depends on whether the tilde is used in the DCF or in an agent.
Tilde in the DCF
The number at the end indicates how many spaces you would like between the words inside the quotation marks. In my example above "medicine sore throat"~10 the article I found contains the three words, with 10 spaces between the two words that are the furthest apart. You can see the spaces in the image below, highlighted in purple:
If my query had been "medicine sore throat"~9 this article would not have been brought back to me.
Tilde in an agent
The number at the end indicates the size of the group of words in which you expect your keywords to be found. In my example for "medicine sore throat"~10 the article I found contains the keywords in a group of 11 words (you can see the words counted in the image below).
So with the the query "medicine sore throat"~10, this article would not be found. I need to change the tilde to a higher number.
Keep it simple
The point of tilde is to locate keywords together in the same sentence or possibly in the same paragraph. A good rule is to use ~15 for sentences and ~25 for paragraphs.