Proximity Search

In the previous Boolean operators-related tutorial, we demonstrated how you can do a patent or a scholarly search for an exact phrase using straight quotation marks ( abstract:”Cancer treat”). And for more accurate searches, we recommended that you specify the field that you want to search in like in this example, we specified “abstract” as the field.

In this support tooltip in the landing page, you can also find several other fields to choose from.

In this tutorial, we will discuss proximity or adjacency search technique that allows you to modify distances between these 2 terms or reorder them in the phrase with the help of a proximity operator and a number. The number specifies how many words you would like to have between these two terms.

Various search engines use different proximity operators such as N or W or NEAR.

In the Lens we use the tilde, “~” character or symbol as a proximity operator and 0 as a default distance. If you process this search, you will be able to get the same results as searching without the operator and 0 (point to the search results to show that these two results are identical). With number 0 it means that there is No edits allowed between the two words. Note that the search results are identical with or without the tilde and 0.

It is important to clarify here that because (open the first document in the result page) the Lens search engine takes into consideration the root form of a word in a phrase, this search result would also reveal matches to not only the exact “cancer treat” phrase but also to “cancer treating” (point to this term in the abstract) and also cancer treatment, if and when it exists.

If we replace 0 with 1, the search will allow us to find up to 1 word inserted between these two terms which means in addition to an exact match of these two terms, up to 1 edit is tolerated and thus allowing us to explore a larger number of search results compared to the last search wherein ~0 was used.

If we replace 1 with 2 distance units and process the search, you will observe that the number of search results have increased even further and the 2 distance units have allowed up to 2 edits. Moreover, 2 distance units allows for a swap of the term “ treat” from the second to first position (before Cancer) and a move of the word Cancer from first to second position. So the take home message here is that you need 2 distance units to have a transposition or a swap and boost your search results.

If you have more than 2 words such as Abstract:”Cancer cells treat” we would need 4 distance units to allow for transposition of these terms. The first 2 distance units are needed to move the term “treat” from third to second position and the second 2 distance units are needed to move it from second to first position and reordering the other terms.

Hope this demo for proximity search was useful to you. Enjoy using the Lens, a free, open and private resource for you and make sure that you are registered and logged in to save your searches and export larger number of documents. For any question/feedback, email us at or Thank you,



Question: “I am trying to conduct a proximity search using Lens that does not transpose words. Using the example from your support pages, I am effectively trying to find cancer and treat within 5 words of each other (i.e. “cancer treat”~5), but I do not want to find any results in which the words have been transposed (e.g. “cancer treating”). Is this possible?

Answer: Unfortunately, the text index we use (Lucene) only supports proximity searching based on word distance, irrespective of word order.