2

I am thinking of implementing a string search similar to the command-t search in VIM. The context is almost the same: Finding Files in a Webapp.

It's not easy to explain how the command-t search works in a nutshell, so I try to give an example:

The following string:

/documents/companyname/contracts/staff/johndoe.pdf

searched by:

dpanystadoe

matches in that way:

/documents/companyname/contracts/staff/johndoe.pdf

This only makes sense in combination with a live autocomplete search, so it has to be really fast :).

Of course, the most naive approach is to use wildcards and build a search term like this: "%d%p%a%n%y%s%t%a%d%o%e%" but we all know this is a bad idea as long as the data to query grows.

Any ideas how to start? Are there better ways to prepare the data? Which indexes could help?

1
  • Your set of constraints seem too loose to me to result in an efficient solution. At least if you are searching only path, you could start by storing each path element separately as this will make searching easier. Apr 22, 2018 at 20:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.