apoc.text.fuzzyMatch

Details

Syntax

apoc.text.fuzzyMatch(text1, text2)

Description

Performs a fuzzy match search of the two given STRING values.

Arguments

Name

Type

Description

text1

STRING

The first string to be compared against the second.

text2

STRING

The second string to be compared against the first.

Returns

BOOLEAN

Fuzzy matching

The function apoc.text.fuzzyMatch determines whether two STRING values are similar based on their Levenshtein distance, returning true if they are considered similar and false if not.

  • If text1 is shorter than three characters, the maximum Levenshtein distance allowed for apoc.text.fuzzyMatch to return true is 0.

  • If text1 is shorter than five characters, the maximum Levenshtein distance allowed for apoc.text.fuzzyMatch to return true is 1.

  • For all other STRING values, the maximum Levenshtein distance allowed for apoc.text.fuzzyMatch to be return true is 2.

To calculate the distance between two STRING values, use apoc.text.distance.

Usage Examples

RETURN apoc.text.fuzzyMatch("The", "the") AS output
Results
output

true

RETURN apoc.text.fuzzyMatch("This", "That") AS output
Results
output

false

RETURN apoc.text.fuzzyMatch("Their", "There") AS output
Results
output

true