Skip to content

Commit

Permalink
back out changes
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh committed Nov 29, 2024
1 parent 92d7f67 commit c22f9cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.apache.solr.core.PluginInfo;
import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.LoggingStream;
import org.apache.solr.response.ResultContext;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.search.DocIterator;
import org.apache.solr.search.DocList;
Expand Down Expand Up @@ -226,7 +227,6 @@ public void prepare(ResponseBuilder rb) throws IOException {

@Override
public void process(ResponseBuilder rb) throws IOException {
System.out.println("PROCESSS STAGE: " + rb.stage);
SolrParams params = rb.req.getParams();
if (!params.getBool(COMPONENT_NAME, false)) {
return;
Expand All @@ -237,9 +237,6 @@ public void process(ResponseBuilder rb) throws IOException {

@Override
public int distributedProcess(ResponseBuilder rb) throws IOException {
System.out.println("STAGE: " + rb.stage);
System.out.println("STAGE rb.getResults(): " + (rb.getResults() != null));
System.out.println("getResponseDocs.size" + rb.getResponseDocs().size());

SolrParams params = rb.req.getParams();
if (!params.getBool(COMPONENT_NAME, false)) {
Expand All @@ -255,29 +252,14 @@ public int distributedProcess(ResponseBuilder rb) throws IOException {
return ResponseBuilder.STAGE_DONE;
}

// @Override
// public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) {
// SolrParams params = rb.req.getParams();
// // rb.setNeedDocList(true);
// if (!params.getBool(COMPONENT_NAME, false)) {
// return;
// }
//
// // Turn on UBI only when retrieving fields
// if ((sreq.purpose & ShardRequest.PURPOSE_GET_FIELDS) != 0) {
// // should already be true...
// sreq.params.set("ubi", "true");
// } else {
// sreq.params.set("ubi", "false");
// }
// }

public void doStuff(ResponseBuilder rb) throws IOException {

// not sure why but sometimes we get it twoice... how can a response have the
// the same component run twice?
if (rb.rsp.getValues().get("ubi") != null) {
return;
}
SolrParams params = rb.req.getParams();
// if (!params.getBool(COMPONENT_NAME, false)) {
// return;
// }

SolrIndexSearcher searcher = rb.req.getSearcher();

Expand Down Expand Up @@ -311,9 +293,9 @@ public void doStuff(ResponseBuilder rb) throws IOException {
}
}

// ResultContext rc = (ResultContext) rb.rsp.getResponse();
// DocList docs = rc.getDocList();
DocList docs = rb.getResults().docList;
ResultContext rc = (ResultContext) rb.rsp.getResponse();
DocList docs = rc.getDocList();
// DocList docs = rb.getResults().docList;

String docIds = extractDocIds(docs, searcher);
ubiQuery.setDocIds(docIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ public void testUBIQueryStream() throws Exception {

assertNotNull(Instant.parse(tuples.get(0).getString("timestamp")));

// assertNotFields(tuples, "user_query", "event_attributes");

// Include another field to see what is returned
ubiQuery = new UBIQuery("234");
ubiQuery.setApplication("typeahead");
Expand Down Expand Up @@ -309,10 +307,6 @@ protected List<Tuple> getTuples(TupleStream tupleStream) throws IOException {
return tuples;
}

protected void assertOrder(List<Tuple> tuples, int... ids) throws Exception {
assertOrderOf(tuples, "id", ids);
}

protected void assertOrderOf(List<Tuple> tuples, String fieldName, int... ids) throws Exception {
int i = 0;
for (int val : ids) {
Expand Down Expand Up @@ -364,20 +358,6 @@ protected void assertNotFields(List<Tuple> tuples, String... fields) throws Exce
}
}

protected boolean assertGroupOrder(Tuple tuple, int... ids) throws Exception {
List<?> group = (List<?>) tuple.get("tuples");
int i = 0;
for (int val : ids) {
Map<?, ?> t = (Map<?, ?>) group.get(i);
Long tip = (Long) t.get("id");
if (tip.intValue() != val) {
throw new Exception("Found value:" + tip.intValue() + " expecting:" + val);
}
++i;
}
return true;
}

private static SolrCore findSolrCore() {
for (JettySolrRunner solrRunner : cluster.getJettySolrRunners()) {
for (SolrCore solrCore : solrRunner.getCoreContainer().getCores()) {
Expand Down

0 comments on commit c22f9cb

Please sign in to comment.