All query methods are now consistent in treating nil as a blank query and returning an empty result. In the case of .search, an empty result is an empty array. Assigning an empty string to the argument variable in order to treat it exactly the same as an empty string.
…as nil. added some tests for find_by_code
Since there are some names that consist of multiple words, including those in the reverse index so they are searchable. refs gh-1
This method solves the issue of searching for names that are grouped with multiple other names in one of the name fields. In addition to the name fields, the .search method also returns any records that have code fields matching a search term. In this implementation, a reverse index is generated when the class is loaded. Though this adds a very small delay to the load time, it's easier to maintain at this time. One drawback of the current implementation is that the terms are indexed by individual word, so multi-word names won't be returned. refs gh-1