0

I would like to mimic Visual studio's "navigate to" search behaviour. Instead of a regular search that looks for a %searchTerm% with wildcards, it also searches for camel-cased initials in addition to regular text. I will provide some screen snippets to illustrate.

Bog standard match

Match using camel-case new word

combination

enter image description here

enter image description here

How do I allow for matching like this? It seems very advanced & I don't have a clue where to begin developing it in Javascript?

Using a list such as in the images above, how do I match. This question isn't really about the dropdown list autocomplete, more about the matching. I would have approx 300 entries to search.

List items in the images

"propertyAddress", "propertyKey", "propertyRef", "Project_Readme.html", "PropertyController", "PropertyDetailsViewModel.cs", "PropertyDetailsViewModel", "PropertyDeletePromptViewModel", "PropertyIndexViewModel", "PropertyViewModels.cs", "ThirdPartyViewModels", "PropertyThirdPartyViewModel"

ShrapNull
  • 1,090
  • 1
  • 9
  • 15
  • 1
    You can split the keyword to get an array of characters and do a case insensitive `includes()` check on all the entries. – pavi2410 Aug 29 '18 at 19:25
  • 1
    And I don't think regex can help... – pavi2410 Aug 29 '18 at 19:26
  • If not regex, then how? – ShrapNull Aug 30 '18 at 11:43
  • 1
    A manual search of all the characters of the search keyword on the list of entries. If the entry contains all of the characters in any order and number, add it to an array. And then you will have an array with the search results. Sorry if I haven't explained well. – pavi2410 Aug 30 '18 at 17:56
  • 1
    They're individual searches, each with their own criteria. Try to build each one as a separate step, rather than find one solution that fits all. – Reinstate Monica Cellio Sep 03 '18 at 10:04

1 Answers1

0

Apologies for asking a poor question. If anybody is interested I found a solution that covers all my needs. It's not exactly what I asked for, but it basically does what was required.

I used the fuzzy sorting JS library linked & developed by the user at this answer to another question: Fuzzy sorting solution. It uses the sublime text search approach. Excellent demo here. Try it searching Steam games. Great stuff!

I also found a similar answer with a lot less code.

Thanks for your help & suggestions. Hope I didn't waste anybody's time.

ShrapNull
  • 1,090
  • 1
  • 9
  • 15