SOLR-14130: Add parsing instructions for different types of query records

This commit is contained in:
Joel Bernstein 2020-01-15 15:01:09 -05:00
parent 9d72bfc1af
commit 4c473db99d
2 changed files with 32 additions and 0 deletions

View File

@ -295,6 +295,8 @@ public class SolrLogPostTool {
doc.addField("path_s", path);
if(path != null && path.contains("/admin")) {
doc.addField("type_s", "admin");
} else if(path != null && params.contains("/replication")) {
doc.addField("type_s", "replication");
} else {
doc.addField("type_s", "query");
}
@ -481,6 +483,14 @@ public class SolrLogPostTool {
doc.addField("distrib_s", dr);
}
if(parts[0].equals("shards")) {
doc.addField("shards_s", "true");
}
if(parts[0].equals("ids")) {
doc.addField("ids_s", "true");
}
if(parts[0].equals("isShard")) {
String dr = URLDecoder.decode(parts[1], Charset.defaultCharset());
doc.addField("isShard_s", dr);
@ -496,6 +506,23 @@ public class SolrLogPostTool {
doc.addField("facet_s", dr);
}
}
//Special params used to determine what stage a query is.
//So we populate with defaults.
//The absence of the distrib params means its a distributed query.
if(doc.getField("distrib_s") == null) {
doc.addField("distrib_s", "true");
}
if(doc.getField("shards_s") == null) {
doc.addField("shards_s", "false");
}
if(doc.getField("ids_s") == null) {
doc.addField("ids_s", "false");
}
}
}
}

View File

@ -51,6 +51,8 @@ public class SolrLogPostToolTest extends SolrTestCaseJ4 {
SolrInputField wt = doc.getField("wt_s");
SolrInputField distrib = doc.getField("distrib_s");
SolrInputField isShard = doc.getField("isShard_s");
SolrInputField ids = doc.getField("ids_s");
SolrInputField shards = doc.getField("shards_s");
assertEquals(query.getValue(), "*:*");
assertEquals(date.getValue(), "2019-12-09T15:05:01.931");
@ -65,6 +67,9 @@ public class SolrLogPostToolTest extends SolrTestCaseJ4 {
assertEquals(wt.getValue(), "javabin");
assertEquals(distrib.getValue(), "false");
assertEquals(isShard.getValue(), "true");
assertEquals(ids.getValue(), "false");
assertEquals(shards.getValue(), "false");
}
@Test