This file contains 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
curl -XPUT localhost:9200/test -d '{ | |
"settings": { | |
"number_of_shards": 2, | |
"number_of_replicas": 1, | |
"analysis": { | |
"filter": {"myWordDelimiter": {"type": "word_delimiter"}}, | |
"analyzer" : { | |
"myAnalyzer" : { | |
"type": "custom", | |
"tokenizer": "whitespace", |
This file contains 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
/** Indexing part **/ | |
Map<String,Analyzer> analyzerPerField = new HashMap<String,Analyzer>(); | |
analyzerPerField.put("state", new StandardAnalyzer(Version.LUCENE_50)); | |
analyzerPerField.put("region", new StandardAnalyzer(Version.LUCENE_50)); | |
PerFieldAnalyzerWrapper aWrapper = new PerFieldAnalyzerWrapper(new StandardAnalyzer(Version.LUCENE_50), analyzerPerField); //This is the part where after basic setup enhancements should be made | |
IndexWriter iw; | |
Directory dir = new MMapDirectory(new File("/tmp/lucene")); | |
IndexWriterConfig iwConfig = new IndexWriterConfig(Version.LUCENE_50, aWrapper); |
This file contains 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 com.varun.perculator; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.apache.lucene.analysis.Analyzer; | |
import org.apache.lucene.analysis.core.SimpleAnalyzer; | |
import org.apache.lucene.index.Term; | |
import org.apache.lucene.index.memory.MemoryIndex; | |
import org.apache.lucene.queryparser.classic.ParseException; |
This file contains 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
poublic class ConstantSimilarity extends DefaultSimilarity { | |
@Override | |
public float tf(float freq) { | |
return 1; | |
} | |
@Override | |
public float idf(long docFreq, long numDocs) { | |
return 1.0f; | |
} | |
@Override public Explanation idfExplain(CollectionStatistics collectionStats, TermStatistics[] stats) { |
This file contains 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
{ | |
"responseHeader":{ | |
"status":0, | |
"QTime":0, | |
"params":{ | |
"facet":"true", | |
"indent":"true", | |
"q":"*:*", | |
"facet.limit":"1", | |
"facet.field":["name", |
This file contains 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
curl http://localhost:8983/solr/update -H 'Content-type:application/json' -d ' | |
[ | |
{ | |
"id": "1", | |
"title": "Doc 1" | |
}, | |
{ | |
"id": "2", | |
"title": "Doc 2" | |
} |
This file contains 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
{ | |
"add": [ | |
{ | |
"id": "1", | |
"title": "Solr adds block join support", | |
"content_type": "parentDocument", | |
"_childDocuments_": [ | |
{ | |
"id": "2", | |
"comments": "SolrCloud supports it too!" |
This file contains 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
SourceOptions | |
XPath/RenderXSL | |
<response> | |
<lst name="responseHeader"> | |
<int name="status">500</int> | |
<int name="QTime">571882</int> | |
</lst> | |
<lst name="error"> | |
<str name="msg">KeeperErrorCode = Session expired for /overseer/collection-queue-work/qnr-0000000106</str> | |
<str name="trace">org.apache.zookeeper.KeeperException$SessionExpiredException: KeeperErrorCode = Session expired for /overseer/collection-queue-work/qnr-0000000106 at org.apache.zookeeper.KeeperException.create(KeeperException.java:127) at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) at org.apache.zookeeper.ZooKeeper.getData(ZooKeeper.java:1155) at org.apache.solr.common.cloud.SolrZkClient$7.execute(SolrZkClient.java:276) at org.apache.solr.common.cloud.SolrZkClient$7.execute(SolrZkClient.java:273) at org.apache.solr.common.cloud.ZkCmdExecutor.retryOperation(ZkCmdExecutor.java:73) at org.apache.solr.common.cloud.SolrZkClient.getData(SolrZkClient.java:273) at org.apache.solr.cloud.DistributedQueue.offer(DistributedQueue.java:313 |
This file contains 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
-rw-r--r-- 1 varun wheel 162B Apr 29 17:29 _0.cfe | |
-rw-r--r-- 1 varun wheel 328B Apr 29 17:29 _0.cfs | |
-rw-r--r-- 1 varun wheel 259B Apr 29 17:29 _0.si | |
-rw-r--r-- 1 varun wheel 162B Apr 29 17:29 _1.cfe | |
-rw-r--r-- 1 varun wheel 1.7M Apr 29 17:29 _1.cfs | |
-rw-r--r-- 1 varun wheel 259B Apr 29 17:29 _1.si | |
-rw-r--r-- 1 varun wheel 162B Apr 29 17:29 _2.cfe | |
-rw-r--r-- 1 varun wheel 1.7M Apr 29 17:29 _2.cfs | |
-rw-r--r-- 1 varun wheel 259B Apr 29 17:29 _2.si | |
-rw-r--r-- 1 varun wheel 162B Apr 29 17:29 _3.cfe |
This file contains 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
import org.apache.solr.client.solrj.impl.CloudSolrServer; | |
import org.apache.solr.client.solrj.request.UpdateRequest; | |
import org.apache.solr.common.SolrInputDocument; | |
import org.apache.solr.common.params.CoreAdminParams; | |
import java.net.MalformedURLException; | |
import java.util.Random; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.TimeUnit; |
OlderNewer