finds all elements containing the given searchString in any text field and sorts them accordingly.

@param searchString      the searchString to search for
@param sort       the sort query to apply
@return the list of elements found
190460
public final List<T> searchSorted(String searchString, String sort) {
        return this.findSortedByQuery(FULLTEXT_QUERY, sort, searchString);
    }
139078
public List<String[]> getAllMatches(String string) {
		Matcher matcher = pattern.matcher(string);
		List<String[]> matched = new ArrayList<String[]>();
		while(matcher.find()) {
			int count = matcher.groupCount();
			String [] strings = new String[count];
			for(int i = 0; i < count; ++i) {
				strings[i] = matcher.group(i+1);				
			}
			matched.add(strings);
		} 
		return matched;
	}
1231814
def _search(self, searchstring):
        
        if searchstring is None:
            return {}
        ret = {}
        for b in self.backends:
            tmp = self.backends[b].search(searchstring)
            for u in tmp:
                if u not in ret:
                    ret[u] = {}
                self._merge_user_attrs(tmp[u], ret[u], b)
        return ret
372315
private RecordSelector parseRecordSelector(String recordSelectorString) throws Exception {
		if (null == recordSelectorString || "" == recordSelectorString) {
			return null;
		}
		
		{
			Matcher matcher = patternSearchString.matcher(recordSelectorString);
			if( matcher.matches() ) {
				String[] fieldNames = matcher.group(1).split(",");
				String searchString = matcher.group(2);
				return new RecordSelectorSearchString(fieldNames, searchString);
			}
		}
		
		// EQ
		{
			Matcher matcher = patternEq.matcher(recordSelectorString);
			if( matcher.matches() ) {
				return new RecordSelectorComparison(
					matcher.group(1)
					,RecordSelectorComparison.Comparison.EQUAL
					,matcher.group(2)
					);
			}
		}
		
		// NE
		{
			Matcher matcher = patternNe.matcher(recordSelectorString);
			if( matcher.matches() ) {
				return new RecordSelectorComparison(
					matcher.group(1)
					,RecordSelectorComparison.Comparison.NOT_EQUAL
					,matcher.group(2)
					);
			}
		}
		
		// GT
		{
			Matcher matcher = patternGt.matcher(recordSelectorString);
			if( matcher.matches() ) {
				return new RecordSelectorComparison(
					matcher.group(1)
					,RecordSelectorComparison.Comparison.GREATER_THAN
					,matcher.group(2)
					);
			}
		}
		
		// GE
		{
			Matcher matcher = patternGe.matcher(recordSelectorString);
			if( matcher.matches() ) {
				return new RecordSelectorComparison(
					matcher.group(1)
					,RecordSelectorComparison.Comparison.GREATER_THAN_OR_EQUAL
					,matcher.group(2)
					);
			}
		}
		
		// LT
		{
			Matcher matcher = patternLt.matcher(recordSelectorString);
			if( matcher.matches() ) {
				return new RecordSelectorComparison(
					matcher.group(1)
					,RecordSelectorComparison.Comparison.LESS_THAN
					,matcher.group(2)
					);
			}
		}
		
		// LE
		{
			Matcher matcher = patternLe.matcher(recordSelectorString);
			if( matcher.matches() ) {
				return new RecordSelectorComparison(
					matcher.group(1)
					,RecordSelectorComparison.Comparison.LESS_THAN_OR_EQUAL
					,matcher.group(2)
					);
			}
		}
		
		// NULL
		{
			Matcher matcher = patternNull.matcher(recordSelectorString);
			if( matcher.matches() ) {
				return new RecordSelectorComparison(
					matcher.group(1)
					,RecordSelectorComparison.Comparison.IS_NULL
					,(Expression)null
					);
			}
		}
		
		// NOT NULL
		{
			Matcher matcher = patternNotNull.matcher(recordSelectorString);
			if( matcher.matches() ) {
				return new RecordSelectorComparison(
					matcher.group(1)
					,RecordSelectorComparison.Comparison.IS_NOT_NULL
					,(Expression)null
					);
			}
		}

		throw new Exception("Invalid query : can not parse record selector: "+recordSelectorString);
	}
351501
public static ArrayList<Integer> findDistinctIndexesOf( String string, String substringToLookFor )
  {
    ArrayList<Integer> positions = new ArrayList<Integer>();

    if( GosuStringUtil.isEmpty( substringToLookFor ) )
    {
      return positions;
    }

    int i = 0;
    i = GosuStringUtil.indexOf( string, substringToLookFor, i );
    while( i != -1 )
    {
      positions.add( i );
      i += substringToLookFor.length();
      i = GosuStringUtil.indexOf( string, substringToLookFor, i );
    }
    return positions;
  }
992653
public Observable<SearchViewState> search(String searchString) {
    // Empty String, so no search
    if (searchString.isEmpty()) {
      return Observable.just(new SearchViewState.SearchNotStartedYet());
    }

    // search for product
    return searchEngine.searchFor(searchString)
        .map(products -> {
          if (products.isEmpty()) {
            return new SearchViewState.EmptyResult(searchString);
          } else {
            return new SearchViewState.SearchResult(searchString, products);
          }
        })
        .startWith(new SearchViewState.Loading())
        .onErrorReturn(error -> new SearchViewState.Error(searchString, error));
  }
1074914
private String truncateAt(final String input, final String searchString) {
        final int i = input.indexOf(searchString);
        if (i != -1) {
            return input.substring(0, i);
        }
        return input;
    }
817275
public List<Rc> sortByTitleAndFilterDoubles(List<Rc> rcList) {
    List<Rc> result = new ArrayList<Rc>();
    List<Rc> sorted = new ArrayList<Rc>();
    sorted.addAll(rcList);
    Collections.sort(sorted, new Comparator<Rc>() {
      @Override
      public int compare(Rc lRc, Rc rRc) {
        int result = lRc.getTitle().compareTo(rRc.getTitle());
        if (result == 0) {
          result = rRc.getTimestamp().compare(lRc.getTimestamp());
        }
        return result;
      }
    });
    Rc previous = null;
    for (Rc rc : sorted) {
      if (previous == null || (!rc.getTitle().equals(previous.getTitle()))) {
        result.add(rc);
      }
      previous = rc;
    }
    Collections.sort(result, new Comparator<Rc>() {
      @Override
      public int compare(Rc lRc, Rc rRc) {
        int result = rRc.getTimestamp().compare(lRc.getTimestamp());
        return result;
      }
    });
    return result;
  }
622087
public static JinxConstants.SortOrder stringToSortOrder(String sortOrderString) {
        if (JinxUtils.isNullOrEmpty(sortOrderString)) {
            return null;
        }
        JinxConstants.SortOrder retVal = null;
        String s = sortOrderString.toLowerCase().trim().replaceAll("-", "_");
        for (JinxConstants.SortOrder sortOrder : JinxConstants.SortOrder.values()) {
            if (sortOrder.toString().equals(s)) {
                retVal = sortOrder;
                break;
            }
        }
        return retVal;
    }
713313
public Object searchGreater(
                               Object            searchKey)
    {
        SearchComparator comp = searchComparator(SearchComparator.GT);
        Object p = find(comp, searchKey);
        return p;
    }
1302199
public List<WebElement> findElements() {
        if (cachedElementList != null && shouldCache) {
            return cachedElementList;
        }

        List<WebElement> result;
        try {
            result = waitFor(() -> {
                List<WebElement> list = searchContext
                        .findElements(getBy(by, searchContext));
                return list.size() > 0 ? list : null;
            });
        } catch (TimeoutException | StaleElementReferenceException e) {
            result = new ArrayList<>();
        }

        if (shouldCache) {
            cachedElementList = result;
        }
        return result;
    }
895543
public List<Product> searchFor(final Optional<String> searchTerm) {
        if (searchTerm.isPresent()) {
            return products
                    .stream()
                    .filter(matchingProductsFor(searchTerm.get()))
                    .collect(toList());
        } else {
            return products;
        }

    }
988365
@Override
	public String[] searchRoles(String search) throws RolesException {
		// Complete list of users
		String[] roles = role_list.keySet().toArray(new String[role_list.size()]);
		List<String> found = new ArrayList<String>();

		// Look through the list for anyone who matches
		for (int i = 0; i < roles.length; i++) {
			if (roles[i].toLowerCase().contains(search.toLowerCase())) {
				found.add(roles[i]);
			}
		}

		// Return the list
		return found.toArray(new String[found.size()]);
	}
457020
public function setSearchString($searchString): void
    {
        $this->searchString = $searchString;
        $this->query = $this->createSearchQuery();
    }
1037859
public String[] getRow(String searchText) {
        String[] rowElements = null;
        GridRow row = new GridRow(this, searchText, getSearchColumnId(), SearchType.CONTAINS);
        String text = row.getText();
        if (text != null) {
            rowElements = text.split("\n");
        }
        return rowElements;
    }
1096921
private String findSearchStrings(final int start) {
		String longestMatch = null;

		// Loop for each string
		for (int i = 0; i < search.length; i++) {
			// No point checking a String that's too long
			if (start + search[i].length() > bufferLen) {
				continue;
			}

			boolean found = true;

			// Loop for each character in range
			for (int j = 0; j < search[i].length() && (start + j < bufferLen); j++) {
				int diff = buffer[start + j] - search[i].charAt(j);

				if (diff < 0) {
					// Since the strings are all sorted, we can abort if
					// the character is less than the corresponding character in
					// the current search string.
					return longestMatch;
				} else if (diff != 0) {
					found = false;
					break;
				}
			}

			if (found && (longestMatch == null || longestMatch.length() < search[i].length())) {
				longestMatch = search[i];
			}
		}

		return longestMatch;
	}
1131660
public List<String> getFilteredIndexList(String containedString) {
        return getAllIndices().stream()
                .filter(index -> index.contains(containedString))
                .collect(toList());
    }