Skip to content

Commit

Permalink
finish up sort by score pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavis95 committed Nov 12, 2019
1 parent 4c315e4 commit 5f2f39c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions zulia-common/src/main/java/io/zulia/ZuliaConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ public interface ZuliaConstants {
String BATCH_SIZE = "batchSize";
String CURSOR = "cursor";

String SCORE_FIELD = "zuliaScore";
}
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,11 @@ private void handleSortValues(ZuliaQuery.SortRequest sortRequest, ScoreDoc score
ZuliaQuery.FieldSort fieldSort = sortRequest.getFieldSort(c);
String sortField = fieldSort.getSortField();

if (ZuliaConstants.SCORE_FIELD.equals(sortField)) {
sortValues.addSortValue(ZuliaQuery.SortValue.newBuilder().setExists(false));
continue;
}

ZuliaIndex.FieldConfig.FieldType fieldTypeForSortField = indexConfig.getFieldTypeForSortField(sortField);

ZuliaQuery.SortValue.Builder sortValueBuilder = ZuliaQuery.SortValue.newBuilder().setExists(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.zulia.server.search;

import io.zulia.ZuliaConstants;
import io.zulia.message.ZuliaBase.Term;
import io.zulia.message.ZuliaIndex.FieldConfig;
import io.zulia.message.ZuliaQuery.AnalysisRequest;
Expand Down Expand Up @@ -393,7 +394,10 @@ public QueryResponse getQueryResponse() throws Exception {

FieldConfig.FieldType sortType = sortTypeMap.get(sortField);

if (FieldConfig.FieldType.NUMERIC_INT.equals(sortType)) {
if (ZuliaConstants.SCORE_FIELD.equals(sortField)) {
compare = scoreCompare.compare(o1, o2);
}
else if (FieldConfig.FieldType.NUMERIC_INT.equals(sortType)) {
Integer a = sortValues1.getSortValue(sortValueIndex).getIntegerValue();
Integer b = sortValues2.getSortValue(sortValueIndex).getIntegerValue();

Expand Down

0 comments on commit 5f2f39c

Please sign in to comment.