Class FuzzyMatch

java.lang.Object
org.sqlite.Function
com.nnamo.utils.FuzzyMatch

public class FuzzyMatch extends org.sqlite.Function
SQLite custom function to perform fuzzy matching using Levenshtein distance (LevenshteinDistance). This function can be used in SQL queries to compare two strings and return a similarity score.

Usage in SQL: SELECT FuzzyMatch(column1, 'searchTerm') AS similarityScore FROM tableName;

The similarity score is returned as a percentage (0 to 100).

Author:
Davide Galilei
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.sqlite.Function

    org.sqlite.Function.Aggregate, org.sqlite.Function.Window
  • Field Summary

    Fields inherited from class org.sqlite.Function

    FLAG_DETERMINISTIC
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    fuzzyMatch(String textToSearch, String searchTerm)
     
    protected void
     

    Methods inherited from class org.sqlite.Function

    args, create, create, create, destroy, destroy, error, result, result, result, result, result, result, value_blob, value_double, value_int, value_long, value_text, value_type

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FuzzyMatch

      public FuzzyMatch()
  • Method Details

    • xFunc

      protected void xFunc() throws SQLException
      Specified by:
      xFunc in class org.sqlite.Function
      Throws:
      SQLException
    • fuzzyMatch

      public static double fuzzyMatch(String textToSearch, String searchTerm)