Giter VIP home page Giter VIP logo

Comments (2)

freshtonic avatar freshtonic commented on May 25, 2024 2

Hi @timburgan

ActiveStash supports fuzzy string matching. It all comes down to how the indexing is configured in your model.

So to answer your question: yes that is what the example you provided does. For the gory details on how it works, keep reading :)

By default, using stash_index on a string field in your model, e.g. stash_index :email, will allow you to perform exact, range and match queries on that field. The index type "match" is what provides the fuzzy matching.

The text filtering and tokenisation that happens behind the scenes looks like this:

"[email protected]" -> downcase -> tokenise (split on whitespace and special chars *) -> ngram (with token length of 3)

(edit: It's just splitting on whitespace right now)

When saving the record for "[email protected]" you'd end up with something like the following terms in the CipherStash index for the email field on your Users collection:

  • jen
  • exa
  • xam
  • amp
  • mpl
  • net

When querying, the same text tokenisation pipeline is applied to your query terms (i.e. the right hand side of the =~ operator), and if any tokens generated from the query term match any of the tokens from the email index it will return the record.

Text tokenisation pipelines are not yet configurable in ActiveStash but that is on our roadmap.

All terms stored in the CipherStash index and terms produced by a query are of course encrypted and CipherStash cannot see them.

Note that matching using a regular expression is not supported. We take your point that (ab)using the =~ operator may be misleading. I think that the least we can do is provide a sensible error message if someone tries to use it with a regular expression.

Edit: spelling

from activestash.

timburgan avatar timburgan commented on May 25, 2024 2

🥇 love it, thank you @freshtonic

from activestash.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.