migration to solr 4.0.0

pull/1/head
Michael Peter Christen 13 years ago
parent b764de424a
commit e2c4c3c7d3

@ -49,22 +49,27 @@
<classpathentry kind="lib" path="lib/fontbox-1.7.0.jar"/>
<classpathentry kind="lib" path="lib/pdfbox-1.7.0.jar"/>
<classpathentry kind="lib" path="lib/jempbox-1.7.0.jar"/>
<classpathentry kind="lib" path="lib/apache-solr-core-3.6.1.jar" sourcepath="/Users/admin/Development/sourcecode/solr-3.6.1/core/src/java"/>
<classpathentry kind="lib" path="lib/apache-solr-solrj-3.6.1.jar" sourcepath="/Users/admin/Development/sourcecode/solr-3.6.1/core/src/java"/>
<classpathentry kind="lib" path="lib/lucene-core-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-analyzers-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-grouping-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-highlighter-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-phonetic-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-spatial-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-spellchecker-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-memory-3.6.1.jar"/>
<classpathentry kind="lib" path="lib/jaudiotagger-2.0.4-20111207.115108-15.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.7.jar"/>
<classpathentry kind="lib" path="lib/jcl-over-slf4j-1.6.4.jar"/>
<classpathentry kind="lib" path="lib/log4j-over-slf4j-1.6.4.jar"/>
<classpathentry kind="lib" path="lib/slf4j-api-1.6.4.jar"/>
<classpathentry kind="lib" path="lib/slf4j-jdk14-1.6.4.jar"/>
<classpathentry kind="lib" path="lib/apache-solr-core-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/apache-solr-solrj-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-analyzers-common-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-analyzers-phonetic-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-core-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-grouping-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-highlighter-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-memory-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-misc-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-queries-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-queryparser-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-spatial-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-suggest-4.0.0.jar"/>
<classpathentry kind="lib" path="lib/zookeeper-3.3.6.jar"/>
<classpathentry kind="lib" path="lib/spatial4j-0.3.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="lib/icu4j-core.jar"/>
<classpathentry kind="lib" path="lib/htmllexer.jar"/>

@ -40,8 +40,8 @@
<string>$JAVAROOT/lib/J7Zip-modified.jar</string>
<string>$JAVAROOT/lib/activation.jar</string>
<string>$JAVAROOT/lib/apache-mime4j-0.6.jar</string>
<string>$JAVAROOT/lib/apache-solr-core-3.6.1.jar</string>
<string>$JAVAROOT/lib/apache-solr-solrj-3.6.1.jar</string>
<string>$JAVAROOT/lib/apache-solr-core-4.0.0.jar</string>
<string>$JAVAROOT/lib/apache-solr-solrj-4.0.0.jar</string>
<string>$JAVAROOT/lib/arq-2.8.7.jar</string>
<string>$JAVAROOT/lib/bcmail-jdk15-145.jar</string>
<string>$JAVAROOT/lib/bcprov-jdk15-145.jar</string>
@ -63,6 +63,7 @@
<string>$JAVAROOT/lib/icu4j-core.jar</string>
<string>$JAVAROOT/lib/iri-0.8.jar</string>
<string>$JAVAROOT/lib/jakarta-oro-2.0.8.jar</string>
<string>$JAVAROOT/lib/jaudiotagger-2.0.4-20111207.115108-15.jar</string>
<string>$JAVAROOT/lib/jcifs-1.3.15.jar</string>
<string>$JAVAROOT/lib/jcl-over-slf4j-1.6.4.jar</string>
<string>$JAVAROOT/lib/jempbox-1.7.0.jar</string>
@ -73,14 +74,17 @@
<string>$JAVAROOT/lib/json-simple-1.1.jar</string>
<string>$JAVAROOT/lib/log4j-1.2.16.jar</string>
<string>$JAVAROOT/lib/log4j-over-slf4j-1.6.4.jar</string>
<string>$JAVAROOT/lib/lucene-analyzers-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-grouping-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-core-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-highlighter-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-phonetic-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-spatial-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-spellchecker-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-memory-3.6.1.jar</string>
<string>$JAVAROOT/lib/lucene-analyzers-common-4.0.0.jar</string>
<string>$JAVAROOT/lib/lucene-analyzers-phonetic-4.0.0.jar</string>
<string>$JAVAROOT/lib/lucene-core-4.0.0.jar</string>
<string>$JAVAROOT/lib/lucene-grouping-4.0.0.jar</string>
<string>$JAVAROOT/lib/lucene-highlighter-4.0.0.jar</string>
<string>$JAVAROOT/lib/lucene-memory-4.0.0.jar</string>
<string>$JAVAROOT/lib/lucene-misc-4.0.0.jar</string>
<string>$JAVAROOT/lib/lucene-queries-4.0.0.jar</string>
<string>$JAVAROOT/lib/lucene-queryparser-4.0.0.jar</string>
<string>$JAVAROOT/lib/lucene-spatial-4.0.0.jar</string>
<string>$JAVAROOT/lib/lucene-suggest-4.0.0.jar</string>
<string>$JAVAROOT/lib/metadata-extractor-2.4.0-beta-1.jar</string>
<string>$JAVAROOT/lib/mysql-connector-java-5.1.12-bin.jar</string>
<string>$JAVAROOT/lib/pdfbox-1.7.0.jar</string>
@ -90,11 +94,13 @@
<string>$JAVAROOT/lib/servlet-api-2.5-20081211.jar</string>
<string>$JAVAROOT/lib/slf4j-api-1.6.4.jar</string>
<string>$JAVAROOT/lib/slf4j-jdk14-1.6.4.jar</string>
<string>$JAVAROOT/lib/spatial4j-0.3.jar</string>
<string>$JAVAROOT/lib/webcat-0.1-swf.jar</string>
<string>$JAVAROOT/lib/wstx-asl-3.2.7.jar</string>
<string>$JAVAROOT/lib/xercesImpl.jar</string>
<string>$JAVAROOT/lib/xml-apis.jar</string>
<string>$JAVAROOT/lib/yacycore.jar</string>
<string>$JAVAROOT/lib/zookeeper-3.3.6.jar</string>
</array>
<key>Properties</key>
<dict>

@ -159,8 +159,8 @@
<pathelement location="${lib}/J7Zip-modified.jar" />
<pathelement location="${lib}/activation.jar" />
<pathelement location="${lib}/apache-mime4j-0.6.jar" />
<pathelement location="${lib}/apache-solr-core-3.6.1.jar" />
<pathelement location="${lib}/apache-solr-solrj-3.6.1.jar" />
<pathelement location="${lib}/apache-solr-core-4.0.0.jar" />
<pathelement location="${lib}/apache-solr-solrj-4.0.0.jar" />
<pathelement location="${lib}/arq-2.8.7.jar" />
<pathelement location="${lib}/bcmail-jdk15-145.jar" />
<pathelement location="${lib}/bcprov-jdk15-145.jar" />
@ -182,6 +182,7 @@
<pathelement location="${lib}/icu4j-core.jar" />
<pathelement location="${lib}/iri-0.8.jar" />
<pathelement location="${lib}/jakarta-oro-2.0.8.jar" />
<pathelement location="${lib}/jaudiotagger-2.0.4-20111207.115108-15.jar" />
<pathelement location="${lib}/jcifs-1.3.15.jar" />
<pathelement location="${lib}/jcl-over-slf4j-1.6.4.jar" />
<pathelement location="${lib}/jempbox-1.7.0" />
@ -193,14 +194,17 @@
<pathelement location="${lib}/jsoup-1.6.3.jar" />
<pathelement location="${lib}/log4j-1.2.16.jar" />
<pathelement location="${lib}/log4j-over-slf4j-1.6.4.jar" />
<pathelement location="${lib}/lucene-analyzers-3.6.1.jar" />
<pathelement location="${lib}/lucene-grouping-3.6.1.jar" />
<pathelement location="${lib}/lucene-core-3.6.1.jar" />
<pathelement location="${lib}/lucene-highlighter-3.6.1.jar" />
<pathelement location="${lib}/lucene-phonetic-3.6.1.jar" />
<pathelement location="${lib}/lucene-spatial-3.6.1.jar" />
<pathelement location="${lib}/lucene-spellchecker-3.6.1.jar" />
<pathelement location="${lib}/lucene-memory-3.6.1.jar" />
<pathelement location="${lib}/lucene-analyzers-common-4.0.0.jar" />
<pathelement location="${lib}/lucene-analyzers-phonetic-4.0.0.jar" />
<pathelement location="${lib}/lucene-core-4.0.0.jar" />
<pathelement location="${lib}/lucene-grouping-4.0.0.jar" />
<pathelement location="${lib}/lucene-highlighter-4.0.0.jar" />
<pathelement location="${lib}/lucene-memory-4.0.0.jar" />
<pathelement location="${lib}/lucene-misc-4.0.0.jar" />
<pathelement location="${lib}/lucene-queries-4.0.0.jar" />
<pathelement location="${lib}/lucene-queryparser-4.0.0.jar" />
<pathelement location="${lib}/lucene-spatial-4.0.0.jar" />
<pathelement location="${lib}/lucene-suggest-4.0.0.jar" />
<pathelement location="${lib}/metadata-extractor-2.4.0-beta-1.jar" />
<pathelement location="${lib}/mysql-connector-java-5.1.12-bin.jar" />
<pathelement location="${lib}/pdfbox-1.7.0.jar" />
@ -210,11 +214,12 @@
<pathelement location="${lib}/servlet-api-2.5-20081211.jar" />
<pathelement location="${lib}/slf4j-api-1.6.4.jar" />
<pathelement location="${lib}/slf4j-jdk14-1.6.4.jar" />
<pathelement location="${lib}/spatial4j-0.3.jar" />
<pathelement location="${lib}/webcat-0.1-swf.jar" />
<pathelement location="${lib}/wstx-asl-3.2.7.jar" />
<pathelement location="${lib}/xercesImpl.jar" />
<pathelement location="${lib}/xml-apis.jar" />
<pathelement location="${lib}/jaudiotagger-2.0.4-20111207.115108-15.jar" />
<pathelement location="${lib}/zookeeper-3.3.6.jar" />
</path>
<target name="compile-core" depends="init" description="compile YaCy core">

File diff suppressed because it is too large Load Diff

@ -43,10 +43,10 @@ import net.yacy.server.serverSwitch;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.util.FastWriter;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.search.DocSlice;
import org.apache.solr.util.FastWriter;
// try

@ -47,7 +47,6 @@ import net.yacy.server.serverSwitch;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.FastWriter;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrCore;
import org.apache.solr.request.SolrQueryRequest;
@ -55,6 +54,7 @@ import org.apache.solr.response.QueryResponseWriter;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.response.XSLTResponseWriter;
import org.apache.solr.search.DocSlice;
import org.apache.solr.util.FastWriter;
// try
@ -72,12 +72,14 @@ public class select {
try {solrServlet.init(null);} catch (ServletException e) {}
RESPONSE_WRITER.putAll(SolrCore.DEFAULT_RESPONSE_WRITERS);
XSLTResponseWriter xsltWriter = new XSLTResponseWriter();
OpensearchResponseWriter opensearchResponseWriter = new OpensearchResponseWriter();
@SuppressWarnings("rawtypes")
NamedList initArgs = new NamedList();
xsltWriter.init(initArgs);
RESPONSE_WRITER.put("xslt", xsltWriter); // try i.e. http://localhost:8090/solr/select?q=*:*&start=0&rows=10&wt=xslt&tr=json.xsl
RESPONSE_WRITER.put("exml", new EnhancedXMLResponseWriter());
RESPONSE_WRITER.put("rss", new OpensearchResponseWriter()); //try http://localhost:8090/solr/select?wt=rss&q=olympia&hl=true&hl.fl=text_t,h1,h2
RESPONSE_WRITER.put("rss", opensearchResponseWriter); //try http://localhost:8090/solr/select?wt=rss&q=olympia&hl=true&hl.fl=text_t,h1,h2
RESPONSE_WRITER.put("opensearch", opensearchResponseWriter); //try http://localhost:8090/solr/select?wt=rss&q=olympia&hl=true&hl.fl=text_t,h1,h2
RESPONSE_WRITER.put("yjson", new JsonResponseWriter()); //try http://localhost:8090/solr/select?wt=json&q=olympia&hl=true&hl.fl=text_t,h1,h2
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -45,7 +45,6 @@ import net.yacy.cora.federate.solr.connector.EmbeddedSolrConnector;
import org.apache.lucene.document.Document;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.util.FastWriter;
import org.apache.solr.core.SolrCore;
import org.apache.solr.request.ServletSolrParams;
import org.apache.solr.request.SolrQueryRequest;
@ -58,6 +57,7 @@ import org.apache.solr.search.DocList;
import org.apache.solr.search.SolrIndexSearcher;
import org.apache.solr.servlet.cache.HttpCacheHeaderUtil;
import org.apache.solr.servlet.cache.Method;
import org.apache.solr.util.FastWriter;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.Context;

@ -174,7 +174,7 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen
public void add(final File file, final String solrId) throws IOException {
final ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update/extract");
up.addFile(file);
up.addFile(file, "application/octet-stream");
up.setParam("literal.id", solrId);
up.setParam("uprefix", "attr_");
up.setParam("fmap.content", "attr_content");

@ -29,12 +29,13 @@ import java.util.Set;
import net.yacy.cora.federate.solr.SolrType;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.IndexableField;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.common.util.XML;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.QueryResponseWriter;
import org.apache.solr.response.ResultContext;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.schema.DateField;
import org.apache.solr.schema.FieldType;
@ -43,7 +44,6 @@ import org.apache.solr.schema.SchemaField;
import org.apache.solr.schema.TextField;
import org.apache.solr.search.DocIterator;
import org.apache.solr.search.DocList;
import org.apache.solr.search.DocSlice;
import org.apache.solr.search.SolrIndexSearcher;
public class EnhancedXMLResponseWriter implements QueryResponseWriter {
@ -74,9 +74,8 @@ public class EnhancedXMLResponseWriter implements QueryResponseWriter {
assert values.get("responseHeader") != null;
assert values.get("response") != null;
@SuppressWarnings("unchecked")
SimpleOrderedMap<Object> responseHeader = (SimpleOrderedMap<Object>) rsp.getResponseHeader();
DocSlice response = (DocSlice) values.get("response");
DocList response = ((ResultContext) values.get("response")).docs;
@SuppressWarnings("unchecked")
SimpleOrderedMap<Object> highlighting = (SimpleOrderedMap<Object>) values.get("highlighting");
writeProps(writer, "responseHeader", responseHeader); // this.writeVal("responseHeader", responseHeader);
@ -139,11 +138,11 @@ public class EnhancedXMLResponseWriter implements QueryResponseWriter {
writeTag(writer, "float", "score", Float.toString(score), false);
}
List<Fieldable> fields = doc.getFields();
List<IndexableField> fields = doc.getFields();
int sz = fields.size();
int fidx1 = 0, fidx2 = 0;
while (fidx1 < sz) {
Fieldable value = fields.get(fidx1);
IndexableField value = fields.get(fidx1);
String fieldName = value.name();
fidx2 = fidx1 + 1;
while (fidx2 < sz && fieldName.equals(fields.get(fidx2).name())) {

@ -37,15 +37,16 @@ import net.yacy.peers.operation.yacyVersion;
import net.yacy.search.Switchboard;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.IndexableField;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.common.util.XML;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.QueryResponseWriter;
import org.apache.solr.response.ResultContext;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.search.DocIterator;
import org.apache.solr.search.DocSlice;
import org.apache.solr.search.DocList;
import org.apache.solr.search.SolrIndexSearcher;
/**
@ -139,9 +140,8 @@ public class GSAResponseWriter implements QueryResponseWriter {
long start = System.currentTimeMillis();
@SuppressWarnings("unchecked")
SimpleOrderedMap<Object> responseHeader = (SimpleOrderedMap<Object>) rsp.getResponseHeader();
DocSlice response = (DocSlice) rsp.getValues().get("response");
DocList response = ((ResultContext) rsp.getValues().get("response")).docs;
@SuppressWarnings("unchecked")
SimpleOrderedMap<Object> highlighting = (SimpleOrderedMap<Object>) rsp.getValues().get("highlighting");
Map<String, List<String>> snippets = OpensearchResponseWriter.highlighting(highlighting);
@ -214,13 +214,13 @@ public class GSAResponseWriter implements QueryResponseWriter {
for (int i = 0; i < responseCount; i++) {
int id = iterator.nextDoc();
Document doc = searcher.doc(id, SOLR_FIELDS);
List<Fieldable> fields = doc.getFields();
List<IndexableField> fields = doc.getFields();
int fieldc = fields.size();
// pre-scan the fields to get the mime-type
String mime = "";
for (int j = 0; j < fieldc; j++) {
Fieldable value = fields.get(j);
IndexableField value = fields.get(j);
String fieldName = value.name();
if (YaCySchema.content_type.getSolrFieldName().equals(fieldName)) {
mime = value.stringValue();
@ -235,7 +235,7 @@ public class GSAResponseWriter implements QueryResponseWriter {
int size = 0;
boolean title_written = false; // the solr index may contain several; we take only the first which should be the visible tag in <title></title>
for (int j = 0; j < fieldc; j++) {
Fieldable value = fields.get(j);
IndexableField value = fields.get(j);
String fieldName = value.name();
// apply generic matching rule

@ -36,14 +36,15 @@ import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.server.serverObjects;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.IndexableField;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.QueryResponseWriter;
import org.apache.solr.response.ResultContext;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.search.DocIterator;
import org.apache.solr.search.DocSlice;
import org.apache.solr.search.DocList;
import org.apache.solr.search.SolrIndexSearcher;
@ -88,9 +89,8 @@ public class JsonResponseWriter implements QueryResponseWriter {
assert values.get("responseHeader") != null;
assert values.get("response") != null;
@SuppressWarnings("unchecked")
SimpleOrderedMap<Object> responseHeader = (SimpleOrderedMap<Object>) rsp.getResponseHeader();
DocSlice response = (DocSlice) values.get("response");
DocList response = ((ResultContext) values.get("response")).docs;
@SuppressWarnings("unchecked")
SimpleOrderedMap<Object> facetCounts = (SimpleOrderedMap<Object>) values.get("facet_counts");
@SuppressWarnings("unchecked")
@ -124,14 +124,14 @@ public class JsonResponseWriter implements QueryResponseWriter {
writer.write("{\n".toCharArray());
int id = iterator.nextDoc();
Document doc = searcher.doc(id, OpensearchResponseWriter.SOLR_FIELDS);
List<Fieldable> fields = doc.getFields();
List<IndexableField> fields = doc.getFields();
int fieldc = fields.size();
List<String> texts = new ArrayList<String>();
MultiProtocolURI url = null;
String description = "", title = "";
StringBuilder path = new StringBuilder(80);
for (int j = 0; j < fieldc; j++) {
Fieldable value = fields.get(j);
IndexableField value = fields.get(j);
String fieldName = value.name();
// apply generic matching rule

@ -36,15 +36,16 @@ import net.yacy.cora.lod.vocabulary.DublinCore;
import net.yacy.cora.protocol.HeaderFramework;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.IndexableField;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.common.util.XML;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.QueryResponseWriter;
import org.apache.solr.response.ResultContext;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.search.DocIterator;
import org.apache.solr.search.DocSlice;
import org.apache.solr.search.DocList;
import org.apache.solr.search.SolrIndexSearcher;
public class OpensearchResponseWriter implements QueryResponseWriter {
@ -100,9 +101,8 @@ public class OpensearchResponseWriter implements QueryResponseWriter {
assert values.get("responseHeader") != null;
assert values.get("response") != null;
@SuppressWarnings("unchecked")
SimpleOrderedMap<Object> responseHeader = (SimpleOrderedMap<Object>) rsp.getResponseHeader();
DocSlice response = (DocSlice) values.get("response");
DocList response = ((ResultContext) values.get("response")).docs;
@SuppressWarnings("unchecked")
SimpleOrderedMap<Object> highlighting = (SimpleOrderedMap<Object>) values.get("highlighting");
Map<String, List<String>> snippets = highlighting(highlighting);
@ -151,12 +151,12 @@ public class OpensearchResponseWriter implements QueryResponseWriter {
openTag(writer, "item");
int id = iterator.nextDoc();
Document doc = searcher.doc(id, SOLR_FIELDS);
List<Fieldable> fields = doc.getFields();
List<IndexableField> fields = doc.getFields();
int fieldc = fields.size();
List<String> texts = new ArrayList<String>();
String description = "", title = "";
for (int j = 0; j < fieldc; j++) {
Fieldable value = fields.get(j);
IndexableField value = fields.get(j);
String fieldName = value.name();
// apply generic matching rule

@ -72,6 +72,9 @@ import org.apache.solr.common.SolrInputDocument;
public final class Fulltext implements Iterable<byte[]> {
private static final String SOLR_PATH = "solr_40"; // the number should be identical to the number in the property luceneMatchVersion in solrconfig.xml
private static final String SOLR_OLD_PATH[] = new String[]{"solr_36"};
private static final long forcedCommitTimeout = 3000; // wait this time until a next forced commit is executed
// class objects
@ -116,16 +119,20 @@ public final class Fulltext implements Iterable<byte[]> {
}
public void connectLocalSolr(final int commitWithin) throws IOException {
File solrLocation = this.location;
if (solrLocation.getName().equals("default")) solrLocation = solrLocation.getParentFile();
String solrPath = "solr_36";
solrLocation = new File(solrLocation, solrPath); // the number should be identical to the number in the property luceneMatchVersion in solrconfig.xml
File baseLocation = this.location;
if (baseLocation.getName().equals("default")) baseLocation = baseLocation.getParentFile();
File solrLocation = new File(baseLocation, SOLR_PATH);
// migrate old solr to new
for (String oldVersion: SOLR_OLD_PATH) {
File oldLocation = new File(baseLocation, oldVersion);
if (oldLocation.exists()) oldLocation.renameTo(solrLocation);
}
EmbeddedSolrConnector esc = new EmbeddedSolrConnector(solrLocation, new File(new File(Switchboard.getSwitchboard().appPath, "defaults"), "solr"));
esc.setCommitWithinMs(commitWithin);
Version luceneVersion = esc.getConfig().getLuceneVersion("luceneMatchVersion");
String lvn = luceneVersion.name();
int p = lvn.indexOf('_');
assert solrPath.endsWith(lvn.substring(p)) : "luceneVersion = " + lvn + ", solrPath = " + solrPath + ", p = " + p;
assert SOLR_PATH.endsWith(lvn.substring(p)) : "luceneVersion = " + lvn + ", solrPath = " + SOLR_PATH + ", p = " + p + ", check defaults/solr/solrconfig.xml";
Log.logInfo("MetadataRepository", "connected solr in " + solrLocation.toString() + ", lucene version " + lvn);
this.solr.connect0(esc);
}

Loading…
Cancel
Save