This file contains hidden or 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
| trait ElasticSearch { | |
| import org.elasticsearch.node._ | |
| import org.elasticsearch.node.NodeBuilder._ | |
| val ELASTIC_URL = "http://localhost:9200" | |
| val INDEX_URL = ELASTIC_URL + "/examples/gists" | |
| val SEARCH_URL = INDEX_URL + "/_search" | |
| private var node: Option[Node] = None |
This file contains hidden or 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
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2013 YOUR_NAME_HERE <YOUR_URL_HERE> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
This file contains hidden or 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 akka.actor._ | |
| import akka.pattern.ask | |
| import akka.util.Timeout | |
| import scala.concurrent.duration._ | |
| import scala.concurrent.Future | |
| import play.api._ |
This file contains hidden or 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.mvc._ | |
| import play.api.libs.EventSource | |
| import play.api.libs.iteratee._ | |
| object Application extends Controller { | |
| val events = Enumerator.repeat("0") | |
This file contains hidden or 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
| private val LB = "\r\n" | |
| val concatLine: Iteratee[Parsing.MatchInfo[Array[Byte]],String] = | |
| (Enumeratee.breakE[Parsing.MatchInfo[Array[Byte]]](_.isMatch) ><> | |
| Enumeratee.collect{ case Parsing.Unmatched(bytes) => new String(bytes)} &>> | |
| Iteratee.consume()).flatMap(r => Iteratee.head.map(_ => r)) | |
| def lineParser = | |
| Enumeratee.map{ s: Array[Byte] => | |
| (if(s.contains(LB + LB)) |