Is there a way in javascript to search against an array and return results based on relevancy, similar to Apache Solr full-text search capabilities?
Example:
var testData = [
'101',
'102C',
'103B',
'A',
'BD',
'AB',
'A102B',
'A1',
];
//if search Text is 102
var searchText = "102";
// results would be 102C, A102B
//if search Text is 102B
var searchText = "102B";
// result would be A102B, 102C
//if search Text is A
var searchText = "A";
// result would be A, A1, AB, A102
Related question : stackoverflow.com/questions/5324798/
What is the best way to approach this using JavaScript?
It appears you are looking for fuzzy search functionality that returns results based on relevancy. Take a look at Fuse.js, it provides Solr-like searching against arrays and objects in JavaScript.