Jeroen Rosenberg jeroenr

View gist:9736785
1 2 3 4 5 6 7
Tire::Search::SearchRequestFailed: 500 : {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[OPzsjdlGT7OFa5NJligHXw][users][2]: QueryPhaseExecutionException[[users][2]: query[Constan
tScore(*:*)],from[0],size[5],sort[<custom:\"lastavailable\": org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSourc
e@20f963b9>]: Query Failed [Failed to execute main query]]; nested: IllegalAccessError[org/elasticsearch/index/fielddata/ScriptDocValues
$Strings$1]; }{[OPzsjdlGT7OFa5NJligHXw][users][3]: QueryPhaseExecutionException[[users][3]: query[ConstantScore(*:*)],from[0],size[5],so
rt[<custom:\"lastavailable\": org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@7c5b27c1>]: Query Failed [Fai
led to execute main query]]; nested: IllegalAccessError[org/elasticsearch/index/fielddata/ScriptDocValues$Strings$1]; }{[OPzsjdlGT7OFa5N
JligHXw][users][0]: QueryPhaseExecutionException[[users][0]: query[ConstantScore(*:*)],from[0],s
View Build.scala
1 2 3 4 5 6 7 8 9 10
object ApplicationBuild extends Build {
val appName = "my-app"
val appVersion = "1-SNAPSHOT"
 
val appDependencies = Seq(
jdbc,
cache
)
 
val main = play.Project(appName, appVersion, appDependencies)
View SetCharacterEncodingFilter.java
1 2 3 4 5 6 7 8 9
package nl.ibanx.web.filter;
 
import java.io.IOException;
import javax.servlet.*;
 
/**
* Set the character encoding of the request to UTF-8.
*/
public class SetCharacterEncodingFilter implements Filter {
View JsonUtil.scala
1 2 3 4 5 6 7 8 9 10
import com.fasterxml.jackson.databind.{DeserializationFeature, ObjectMapper}
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
 
object JsonUtil {
val mapper = new ObjectMapper with ScalaObjectMapper
mapper.registerModule(DefaultScalaModule)
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
 
def toJson(value: Map[Symbol, Any]): String = {
View Build.scala
1 2 3 4 5 6 7 8 9 10
import sbt._
import Keys._
import play.Project._
 
object ApplicationBuild extends Build {
 
val appName = "tweetsearch"
val appVersion = "1.0-SNAPSHOT"
 
val appDependencies = Seq(
View posts_router.js.coffee
1 2 3 4 5 6 7 8 9 10
class Blog.Routers.PostsRouter extends Backbone.Router
 
routes:
"posts/:page" : "index"
".*" : "index"
 
index: (page) ->
pageNumber = page || 1
@posts = new Blog.Collections.PostsCollection()
@view = new Blog.Views.Posts.IndexView({model:@posts, page:parseInt(pageNumber)+1})
View index.html.erb
1 2 3 4 5 6 7 8 9
<div id="posts"></div>
 
<script type="text/javascript">
$(function() {
// Blog is the app name
window.router = new Blog.Routers.PostsRouter({posts: <%= @posts.to_json.html_safe -%>});
Backbone.history.start();
});
</script>
View WeirdIntegerParser.scala
1 2 3 4 5 6 7 8 9 10
val MaxInt = """inf""".r
val NormalInt = """\d*""".r
 
def parseInt(integerString:String) = {
integerString match {
case MaxInt(_) => Integer.MAX_VALUE
case NormalInt(_) => Integer.valueOf(integerString)
case _ => throw new NumberFormatException(String.format("Cannot parse %s as an integer", integerString))
}
}
View Accommodation.rb
1 2 3 4 5 6 7 8 9 10
class Accommodation < ActiveResource::Base
class << self
def element_path(id, prefix_options = {}, query_options = nil)
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
"#{prefix(prefix_options)}#{collection_name}/#{id}#{query_string(query_options)}"
end
 
def collection_path(prefix_options = {}, query_options = nil)
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
"#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}"
View Gemfile
1 2 3 4 5 6 7 8 9 10
source 'https://rubygems.org'
 
gem 'rails', '3.2.3'
 
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
Something went wrong with that request. Please try again.