Skip to content

Commit

Permalink
style(api): rename searchResults to orderResults
Browse files Browse the repository at this point in the history
  • Loading branch information
Harjot1Singh committed May 17, 2019
1 parent 59d9514 commit 91088e7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/models/Lines.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class LineQueryBuilder extends CommonQueryBuilder {
* Given a search query and column, return a query that searches for the shabad.
* @param search The query to search for a partial match of.
* @param field The field to query.
* @param shouldOrder Apply sensible ordering too. `true` by default.
* @param orderResults Apply sensible ordering too. `true` by default.
*/
genericSearch( search, field, shouldOrder = true ) {
genericSearch( search, field, orderResults = true ) {
let query = this
// Convert query to ASCII if they are not
const asciiSearch = !isAscii( search ) ? toAscii( search ) : search
Expand All @@ -27,8 +27,8 @@ class LineQueryBuilder extends CommonQueryBuilder {
query = query.where( field, 'LIKE', `%${asciiSearch}%` )

// Only apply sensible ordering if specified
if ( shouldOrder ) {
query = query.orderSearch( asciiSearch, field )
if ( orderResults ) {
query = query.orderResults( asciiSearch, field )
}

return query
Expand All @@ -40,7 +40,7 @@ class LineQueryBuilder extends CommonQueryBuilder {
* @param field The field to query.
* @private
*/
orderSearch( search, field ) {
orderResults( search, field ) {
// Wildcards for exact match, first letters, letters anywhere
const variants = [ search, `${search}%`, `%${search}%` ]

Expand All @@ -56,19 +56,19 @@ class LineQueryBuilder extends CommonQueryBuilder {
/**
* Given a string of first letters, return a query that searches for the shabad.
* @param letters The first letters to search for a partial match of.
* @param shouldOrder Apply sensible ordering too. `true` by default.
* @param orderResults Apply sensible ordering too. `true` by default.
*/
firstLetters( letters, shouldOrder = true ) {
return this.genericSearch( letters, 'first_letters', shouldOrder )
firstLetters( letters, orderResults = true ) {
return this.genericSearch( letters, 'first_letters', orderResults )
}

/**
* Given a phrase, return a query that searches for the shabad.
* @param phrase the phrase to match.
* @param shouldOrder Apply sensible ordering too. `true` by default.
* @param orderResults Apply sensible ordering too. `true` by default.
*/
fullWord( phrase, shouldOrder ) {
return this.genericSearch( phrase, 'gurmukhi', shouldOrder )
fullWord( phrase, orderResults ) {
return this.genericSearch( phrase, 'gurmukhi', orderResults )
}
}

Expand Down

0 comments on commit 91088e7

Please sign in to comment.