Skip to content

Instantly share code, notes, and snippets.

@need4spd
need4spd / FacetSearch.java
Created February 5, 2014 14:14
facet search sample
package com.tistory.devyongsik.search;
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.facet.index.FacetFields;
import org.apache.lucene.facet.params.FacetSearchParams;
import org.apache.lucene.facet.search.CountFacetRequest;
import org.apache.lucene.facet.search.FacetResult;
@need4spd
need4spd / DrillDownFacetSearch.java
Created February 6, 2014 00:24
DrillDownFacetSearch.java
package com.tistory.devyongsik.search;
import com.google.common.collect.Lists;
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.facet.index.FacetFields;
import org.apache.lucene.facet.params.FacetSearchParams;
import org.apache.lucene.facet.search.*;
@need4spd
need4spd / closure.js
Last active August 29, 2015 13:57
closure.js
var getResult = (function() {
var res = 2 + 2;
return function() {
return res;
};
}());
gerResult; //function () { return res; }
getResult(); //4
@need4spd
need4spd / execfunction.js
Created April 2, 2014 00:33
execfunction
var o = {
message: (function() {
var who = "me", what = "call";
alert(1);
return what + " " + who; }()),
getMsg: function() {
return this.message;
}
};
@need4spd
need4spd / DateTime.java
Last active August 29, 2015 14:01
Joda DateTime parse
//String to DateTime
//05/28/2014 11:31
DateTimeFormatter fmt = DateTimeFormat.forPattern("MM/dd/yyyy HH:mm");
fmt.parseDateTime("05/28/2014 11:31");
//Date to String
DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm");
String sqlTimeString = fmt.print(DateTime.now());
@need4spd
need4spd / jpastudy
Created June 11, 2014 00:44
JPA Study - Chapter 2
1. Obtaining an Entity Manager and Persisting an Entity
EntityManagerFactory emf = Persistence.createEntityManagerFactory("EmployeeService");
EntityManager em = emf.createEntityManager();
Employee emp = new Employee(130);
em.persist(emp);
persist가 완료되면 emp 객체는 entity manager의 persistence context에의해 관리된다.
2. Finding an Entity
Employee emp = em.find(Employee.class, 130);
@need4spd
need4spd / Listest.java
Last active August 29, 2015 14:07
List Test
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import lombok.Data;
import org.junit.Before;
import org.junit.Test;
import javax.annotation.Nullable;
import java.util.List;
// create file:
sudo vim /usr/share/applications/intellij.desktop
// add the following
[Desktop Entry]
Version=13.0
Type=Application
Terminal=false
Icon[en_US]=/home/rob/.intellij-13/bin/idea.png
Name[en_US]=IntelliJ
@need4spd
need4spd / gist:4152771
Created November 27, 2012 06:40
sample code
package com.tistory.devyongsik.replication;
import java.io.IOException;
import java.util.Collection;
import org.apache.lucene.index.IndexCommit;
import org.apache.lucene.index.SnapshotDeletionPolicy;
import org.apache.lucene.store.FSDirectory;
@need4spd
need4spd / createComponents.java
Created November 27, 2012 07:02
lucene 4.0에서 reuseStrategy 설명
@Override
protected TokenStreamComponents createComponents(final String fieldName,
final Reader reader) {
return new TokenStreamComponents(new WhitespaceTokenizer(matchVersion, reader));
}