{"size": 493, "ext": "js", "max_stars_repo_path": "lib/handlers/mapQuery3/parse/search.js", "max_stars_repo_name": "nerjs/g_map_bot", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/handlers/mapQuery3/parse/search.js", "max_issues_repo_name": "nerjs/g_map_bot", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/handlers/mapQuery3/parse/search.js", "max_forks_repo_name": "nerjs/g_map_bot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.3888888889, "max_line_length": 55, "alphanum_fraction": 0.6937119675}
const Request = require('../helpers/MapQuery/Request')
const { incorrectSearch } = require('../messages')
const { SEARCH_TEXT } = require('../../../constants')

module.exports = ctx => {
  if (
    !ctx.queryCommandSubtext ||
    ctx.queryCommandSubtext.length < SEARCH_TEXT.MIN ||
    ctx.queryCommandSubtext.length > SEARCH_TEXT.MAX
  )
    return ctx.mapQuery.setError(incorrectSearch)

  ctx.mapQuery.setRequest({
    type: Request.TYPES.SEARCH,
    query: ctx.queryCommandSubtext,
  })
}
