This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rutas | |
# ~~~~ | |
# RegPubFinder | |
GET / controllers.Application.index | |
GET /about controllers.Application.about | |
GET /findByName/:searchText controllers.Application.findByName(searchText: String) | |
GET /typeahead/:searchText controllers.Application.typeahead(searchText: String) | |
GET /sa/:ficha controllers.Application.show(ficha: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import play.api._ | |
import play.api.mvc._ | |
import play.api.libs.json._ | |
import services.RegPubServices | |
object Application extends Controller { | |
def index = Action { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(title: String)(navbarContext: Html)(sidebar: Html)(content: Html) | |
@import tags._ | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="description" content="RegPubFinder"> | |
<meta name="author" content="Rogelio Morrell"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(navbar: Html) | |
<div class="navbar navbar-fixed-top"> | |
<div class="navbar-inner"> | |
<div class="container-fluid"> | |
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@() | |
@navbarContext = { | |
<li class="active"><a href="/">Home</a></li> | |
<li><a href="/about">About</a></li> | |
} | |
@sidebar = { | |
<div class="well sidebar-nav"> | |
<ul class="nav nav-list"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package services | |
import play.api.libs.json._ | |
import org.elasticsearch.action.index._ | |
import org.elasticsearch.common.settings._ | |
import org.elasticsearch.client.transport._ | |
import org.elasticsearch.common.transport.InetSocketTransportAddress | |
import org.elasticsearch.action.search._ | |
import org.elasticsearch.index.query._ | |
import org.elasticsearch.search.sort._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package services | |
import play.api.libs.json._ | |
import play.api.Logger._ | |
object RegPubServices | |
{ | |
def apply() = new RegPubServices() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package services | |
import play.api.libs.json._ | |
import org.elasticsearch.action.index._ | |
import org.elasticsearch.common.settings._ | |
import org.elasticsearch.client.transport._ | |
import org.elasticsearch.common.transport.InetSocketTransportAddress | |
import org.elasticsearch.action.search._ | |
import org.elasticsearch.index.query._ | |
import org.elasticsearch.search.sort._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RegPubServices | |
class RegPubServices extends SearchService with DataModelService { | |
def searchTypeahead(query:String):JsValue = { | |
val hits = typeahead(query) | |
val companyNames = hits.map( hit => (hit \\ "fields").map( h => Map("item" -> h \ "nombre"))).flatten | |
// RM: Alternativamente, para no usar Underscore para crear un array | |
// val companyNames = hits.map( hit => (hit \\ "fields").map( h => h \ "nombre")).flatten | |
Json.toJson(companyNames) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package services | |
import com.mongodb.casbah.Imports._ | |
import com.mongodb.casbah.commons.conversions.scala._ | |
import com.mongodb._ | |
import com.mongodb.ServerAddress | |
import com.mongodb.util._ | |
import scalaj.collection.s2j._ | |
abstract trait RegpubDataUtil { |
OlderNewer