Skip to content

Instantly share code, notes, and snippets.

View karthikshiraly's full-sized avatar

Karthik Shiraly karthikshiraly

View GitHub Profile
@karthikshiraly
karthikshiraly / SolrTokenizerUnitTest.java
Created December 19, 2011 04:51
Unit testing solr 1.4 tokenization
public static void main(String[] args) {
try {
StringReader inputText = new StringReader(args[0]);
TokenizerFactory tkf = new WhitespaceTokenizerFactory();
Tokenizer tkz = tkf.create(inputText);
LowerCaseFilterFactory lcf = new LowerCaseFilterFactory();
TokenStream lcts = lcf.create(tkz);
@karthikshiraly
karthikshiraly / TestSolrTokenization.java
Created December 19, 2011 04:54
Unit testing solr 3.x tokenization
public static void main(String[] args) {
try {
StringReader inputText = new StringReader("RUNNING runnable");
Map<String, String> tkargs = new HashMap<String, String>();
tkargs.put("luceneMatchVersion", "LUCENE_33");
TokenizerFactory tkf = new WhitespaceTokenizerFactory();
tkf.init(tkargs);
Tokenizer tkz = tkf.create(inputText);
@karthikshiraly
karthikshiraly / SchemaTester.java
Created December 19, 2011 04:56
Function testing for Solr 1.4 schema.xml
/*
This class uses Solr 1.4 classes to load its schema.xml and run input text through the analyzers defined
in it.
*/
public class SchemaTester {
public static void main(String[] args) {
try {
InputStream solrCfgIs = new FileInputStream(
"solr/conf/solrconfig.xml");
SolrConfig solrConfig = new SolrConfig(null, solrCfgIs);
@karthikshiraly
karthikshiraly / SchemaTester.java
Created December 19, 2011 04:58
Function testing for Solr 3.3.x schema.xml
/**
* This class uses Solr 3.3.x classes to load schema.xml and runs input text through the analyzers
* defined in it.
*/
public class SchemaTester {
public static void main(String[] args) {
try {
InputSource solrCfgIs = new InputSource(
new FileReader("solr/conf/solrconfig.xml"));
SolrConfig solrConfig = new SolrConfig(null, solrCfgIs);
@karthikshiraly
karthikshiraly / myapp.html
Created January 11, 2012 08:18
Very simple, basic backbone.js example with comments - Demonstrates how to get a value from one porition of UI and update it in another portion of UI via the model
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Backbone.js example</title>
<link rel="stylesheet" type="text/css" href="css/sunny/jqueryui.min.css"/>
</head>
<body>
<!-- "slider" is a jquery slider -->
<div id="slider"></div>