src/utils/StringMatch.js
File StringMatch.js
has 484 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Copyright (c) 2013 - present Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Function _computeRangesAndScore
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _computeRangesAndScore(matchList, str, lastSegmentStart) {
var matchCounter;
var ranges = [];
var lastMatchIndex = -1;
var lastSegmentScore = 0;
Function _generateMatchList
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _generateMatchList(query, str, originalQuery, originalStr, specials, startingSpecial) {
var result = [];
// used to keep track of which special character we're testing now
var specialsCounter = startingSpecial;
Function addMatch
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function addMatch(match) {
// Pull off the character index
var c = match.index;
var newPoints = 0;
Function stringMatch
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function stringMatch(str, query, options, special) {
var result;
options = options || {};
Function multiFieldSort
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function multiFieldSort(searchResults, fieldSpec) {
// Move field names into an array, with primary field first
var comparisons;
if (Array.isArray(fieldSpec)) {
comparisons = fieldSpec;
Function findSpecialCharacters
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function findSpecialCharacters(str) {
var i, c;
// the beginning of the string is always special
var specials = [0];
Function _lastSegmentSearch
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _lastSegmentSearch(query, str, originalQuery, originalStr, specials, startingSpecial, lastSegmentStart) {
var queryCounter, matchList;
// It's possible that the query is longer than the last segment.
// If so, we can chop off the bit that we know couldn't possibly be there.
Function _lastSegmentSearch
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function _lastSegmentSearch(query, str, originalQuery, originalStr, specials, startingSpecial, lastSegmentStart) {
Function _generateMatchList
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function _generateMatchList(query, str, originalQuery, originalStr, specials, startingSpecial) {
Function _wholeStringSearch
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function _wholeStringSearch(queryLower, compareLower, originalQuery, originalStr, specials, lastSegmentSpecialsIndex) {