Skip to content

Commit

Permalink
- added a json writer for solr (yes there was one using xslt but this
Browse files Browse the repository at this point in the history
one writes the same way as yacysearch.json)
- using the new json solr result to change the ajax search in
IndexControlURLs to the new solr search
  • Loading branch information
Orbiter committed Sep 10, 2012
1 parent 4634f0e commit 5df553c
Show file tree
Hide file tree
Showing 5 changed files with 320 additions and 167 deletions.
3 changes: 2 additions & 1 deletion htroot/IndexControlURLs_p.html
Expand Up @@ -21,7 +21,8 @@
else if (window.ActiveXObject) { // IE
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('GET', "yacysearch.json?verify=false&resource=local&maximumRecords=100&nav=none&query=" + query + "+inurl:" + query, true);
self.xmlHttpReq.open('GET', "/solr/select?q=sku:\"" + query + "\" OR host_s:\"" + query + "\" OR host_dnc_s:\"" + query + "\" OR host_organization_s:\"" + query + "\" OR host_organizationdnc_s:\"" + query + "\" OR host_subdomain_s:\"" + query + "\"&start=0&rows=100&wt=json", true);
//self.xmlHttpReq.open('GET', "yacysearch.json?verify=false&resource=local&maximumRecords=100&nav=none&query=" + query + "+inurl:" + query, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {
Expand Down
2 changes: 2 additions & 0 deletions htroot/solr/select.java
Expand Up @@ -32,6 +32,7 @@
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.services.federated.solr.EmbeddedSolrConnector;
import net.yacy.cora.services.federated.solr.EnhancedXMLResponseWriter;
import net.yacy.cora.services.federated.solr.JsonResponseWriter;
import net.yacy.cora.services.federated.solr.OpensearchResponseWriter;
import net.yacy.cora.services.federated.solr.SolrServlet;
import net.yacy.kelondro.logging.Log;
Expand Down Expand Up @@ -75,6 +76,7 @@ public class select {
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("json", new JsonResponseWriter()); //try http://localhost:8090/solr/select?wt=json&q=olympia&hl=true&hl.fl=text_t,h1,h2
}

/**
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/server/serverObjects.java
Expand Up @@ -223,7 +223,7 @@ public String putJSON(final String key, final StringBuilder value) {
return put(key, toJSON(value.toString()));
}

private static String toJSON(String value) {
public static String toJSON(String value) {
// value = value.replaceAll("\\", "\\\\");
value = patternDoublequote.matcher(value).replaceAll("'");
value = patternSlash.matcher(value).replaceAll("\\/");
Expand Down

0 comments on commit 5df553c

Please sign in to comment.