Skip to content

Instantly share code, notes, and snippets.

public class JaccardScoreScript extends AbstractDoubleSearchScript
{
private final ESLogger logger = Loggers.getLogger(JaccardScoreScript.class);
private final double coefficient;
private final String docItemField;
private final String docItemScoreField;
private final List<Long> queryItems;
private final List<Double> queryItemScores;
private final boolean zero;
def addToIndex(docs: Iterable[EsDoc]): Unit = {
for (doc <- docs) {
client.execute {
index into resource fields (doc.data)
}
}
client.admin.cluster.prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet
refresh(indexName)
java.lang.RuntimeException: play.api.libs.json.JsResultException: JsResultException(errors:List((/jobSeeker/careerTarget/positionLevel,List(ValidationError(error.path.missing,WrappedArray())))))
at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:87)
at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:58)
at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:62)
at backtype.storm.daemon.executor$fn__4050$fn__4059$fn__4106.invoke(executor.clj:658)
at backtype.storm.util$async_loop$fn__465.invoke(util.clj:377)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:724)
Caused by: play.api.libs.json.JsResultException: JsResultException(errors:List((/jobSeeker/careerTarget/positionLevel,List(ValidationError(error.path.missing,WrappedArray())))))
at play.api.libs.json.JsValue$$anonfun$2.apply(JsValue.scala:64)
implicit def createRecommenderInput(job: Job) = new {
def toInput: Input = {
val input = new Input (
title = job.title,
disciplines = Set.empty, // TODO get job.disciplines
industries = Set.empty, // TODO get job.industries
positionLevel = 24, // TODO get job.positionLevel
salaryMin = -1, // TODO get job.salaryMin
salaryMax = -1 // TODO get job.salaryMax
)
/* interleave slots so that slots of different nodes are given priority during assignment of topology as opposed to slots of the same node */
private def interleaveSlotsByNode(slots: Set[WorkerSlot]): List[WorkerSlot] = {
val groupedSeq = slots.groupBy(_.getNodeId).toSeq
val slotsByNode = mutable.Map[String, Set[WorkerSlot]](groupedSeq: _*)
val nodes = slotsByNode.keys.toList.sorted
val results = mutable.ListBuffer[WorkerSlot]()
while (!slotsByNode.isEmpty) {
for (node <- nodes) {
slotsByNode.get(node) match {
case Some(slots) => {
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
def currentEnvironment: RiakRestClientParams = EnvironmentSelector.current match {
case "PROD" => {
MetricsInitializer.init(MetricsConfig("riemann-1.idc.theladders.com", "match-jobseekers-with-jobs", "doesnotmatter"))
PROD
}
case _ => QA
}
action.auto_create_index: false
bootstrap.mlockall: true
cluster.name: search_0.90.5-1_prod
discovery.zen.minimum_master_nodes: 9
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["es-a-1", "es-a-2", "es-a-3", "es-a-4", "es-a-5", "es-a-6", "es-a-7", "es-a-8", "es-b-1", "es-b-2", "es-b-3", "es-b-4", "es-b-5", "es-b-6", "es-b-7", "es-b-8"]
gateway.expected_nodes: 16
gateway.recover_after_nodes: 12
index.mapper.dynamic: false
node.max_local_storage_nodes: 1
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="PeterCodeStyle">
<ScalaCodeStyleSettings>
<option name="WRAP_BEFORE_WITH_KEYWORD" value="true" />
<option name="FINALLY_BRACE_FORCE" value="1" />
<option name="TRY_BRACE_FORCE" value="1" />
<option name="CASE_CLAUSE_BRACE_FORCE" value="1" />
<option name="MULTILINE_STRING_SUPORT" value="1" />
<option name="PROCESS_MARGIN_ON_COPY_PASTE" value="false" />
</ScalaCodeStyleSettings>
@ppat
ppat / Maven plugin configuration
Created July 30, 2014 20:31
Adding scala style to your project
<plugin>
<groupId>org.scalastyle</groupId>
<artifactId>scalastyle-maven-plugin</artifactId>
<version>0.4.0</version>
<configuration>
<verbose>false</verbose>
<failOnViolation>true</failOnViolation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<failOnWarning>false</failOnWarning>
<sourceDirectory>${basedir}/src/main/scala</sourceDirectory>