mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-01 08:48:46 +02:00
Merge c5b1f613a3
into 72eda9a24f
This commit is contained in:
commit
d9d8d0d922
|
@ -169,11 +169,7 @@ public class GeoObject {
|
|||
if (Double.compare(a.radius, b.radius) != 0) {
|
||||
return false;
|
||||
}
|
||||
if (a.source != b.source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return a.source == b.source;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -93,8 +93,7 @@ public abstract class AbstractFacetCountingArray implements Flushable {
|
|||
|
||||
protected static final int decodeTermID(int facetID) {
|
||||
if (facetID != UNASSIGNED) {
|
||||
int termID = facetID & TERM_ID_MASK;
|
||||
return termID;
|
||||
return facetID & TERM_ID_MASK;
|
||||
}
|
||||
|
||||
return EarlybirdIndexSegmentAtomicReader.TERM_NOT_FOUND;
|
||||
|
|
|
@ -326,19 +326,19 @@ public class ArchiveSearchPartitionManager extends PartitionManager {
|
|||
|
||||
final ArchiveSegment oldSegment = (ArchiveSegment) segmentInfo.getSegment();
|
||||
|
||||
return indexSegment(newSegmentInfoForIndexing, oldSegmentInfo, input -> {
|
||||
return indexSegment(newSegmentInfoForIndexing, oldSegmentInfo, input ->
|
||||
// we're updating the segment - only index days after the old end date, but only if
|
||||
// we're in the on-disk archive, and we're sure that the previous days have already
|
||||
// been indexed.
|
||||
return !earlybirdIndexConfig.isIndexStoredOnDisk()
|
||||
!earlybirdIndexConfig.isIndexStoredOnDisk()
|
||||
// First time around, and the segment has not been indexed and optimized yet,
|
||||
// we will want to add all the days
|
||||
|| !oldSegmentInfo.isOptimized()
|
||||
|| oldSegmentInfo.getIndexSegment().getIndexStats().getStatusCount() == 0
|
||||
|| !oldSegment.getDataEndDate().before(timeSlice.getEndDate())
|
||||
// Index any new days
|
||||
|| input.after(oldSegment.getDataEndDate());
|
||||
});
|
||||
|| input.after(oldSegment.getDataEndDate())
|
||||
);
|
||||
}
|
||||
|
||||
private boolean existingSegmentNeedsUpdating(ArchiveTimeSlice timeSlice,
|
||||
|
|
|
@ -209,11 +209,11 @@ public class ArchiveSegmentUpdater {
|
|||
return indexSegment(segmentInfo, ArchiveSegment.MATCH_ALL_DATE_PREDICATE);
|
||||
}
|
||||
|
||||
boolean success = indexSegment(segmentInfo, input -> {
|
||||
boolean success = indexSegment(segmentInfo, input ->
|
||||
// we're updating the segment - only index days after the old end date,
|
||||
// and we're sure that the previous days have already been indexed.
|
||||
return input.after(hdfsEndDate);
|
||||
});
|
||||
input.after(hdfsEndDate)
|
||||
);
|
||||
if (!success) {
|
||||
LOG.error("Error indexing new data: " + segmentInfo);
|
||||
return indexSegment(segmentInfo, ArchiveSegment.MATCH_ALL_DATE_PREDICATE);
|
||||
|
|
|
@ -502,10 +502,7 @@ public class SegmentManager {
|
|||
partitionConfig.getIndexingHashPartitionID(),
|
||||
partitionConfig.getNumPartitions());
|
||||
|
||||
SegmentInfo segmentInfo =
|
||||
new SegmentInfo(timeSlice.getSegment(), earlybirdSegmentFactory, segmentSyncConfig);
|
||||
|
||||
return segmentInfo;
|
||||
return new SegmentInfo(timeSlice.getSegment(), earlybirdSegmentFactory, segmentSyncConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -531,10 +528,8 @@ public class SegmentManager {
|
|||
public SegmentWriter createSegmentWriter(long timesliceID) throws IOException {
|
||||
SegmentInfo segmentInfo = createSegmentInfo(timesliceID);
|
||||
|
||||
SegmentWriter writer = new SegmentWriter(
|
||||
return new SegmentWriter(
|
||||
segmentInfo, searchIndexingMetricSet.updateFreshness);
|
||||
|
||||
return writer;
|
||||
}
|
||||
|
||||
private void updateAllListeners(String message) {
|
||||
|
@ -817,6 +812,6 @@ public class SegmentManager {
|
|||
|
||||
@VisibleForTesting
|
||||
ArrayList<Long> getTimeSliceIdsForTests() {
|
||||
return new ArrayList<Long>(segmentWriters.keySet());
|
||||
return new ArrayList<>(segmentWriters.keySet());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ public abstract class AbstractResultsCollector<R extends SearchRequestInfo,
|
|||
queryTime = System.currentTimeMillis();
|
||||
}
|
||||
hitCountsThresholdsMsec = thriftSearchQuery.getHitCountBuckets();
|
||||
hitCounts = hitCountsThresholdsMsec == null || hitCountsThresholdsMsec.size() == 0
|
||||
hitCounts = hitCountsThresholdsMsec == null || hitCountsThresholdsMsec.isEmpty()
|
||||
? null
|
||||
: new int[hitCountsThresholdsMsec.size()];
|
||||
|
||||
|
@ -192,12 +192,7 @@ public abstract class AbstractResultsCollector<R extends SearchRequestInfo,
|
|||
requiredFields.add(field.getFieldType().getFacetName());
|
||||
}
|
||||
}
|
||||
|
||||
if (requiredFields.size() > 0) {
|
||||
return new FacetLabelCollector(requiredFields);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return requiredFields.isEmpty() ? null : new FacetLabelCollector(requiredFields);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -102,7 +102,7 @@ public final class MinFeatureValueFilter extends Query implements FilteredQuery.
|
|||
@Override
|
||||
public FilteredQuery.DocIdFilter getDocIdFilter(LeafReaderContext context) throws IOException {
|
||||
final NumericDocValues featureDocValues = context.reader().getNumericDocValues(featureName);
|
||||
return (docId) -> featureDocValues.advanceExact(docId)
|
||||
return docId -> featureDocValues.advanceExact(docId)
|
||||
&& ((byte) featureDocValues.longValue() >= minValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -414,11 +414,9 @@ public abstract class AbstractRecencyAndRelevanceRequestRouter extends RequestRo
|
|||
}
|
||||
}
|
||||
|
||||
if (adjustedRequestParams.isSetReturnAllResults()) {
|
||||
if (searchQuery.isSetRelevanceOptions()) {
|
||||
if (adjustedRequestParams.isSetReturnAllResults() && searchQuery.isSetRelevanceOptions()) {
|
||||
searchQuery.getRelevanceOptions().setReturnAllResults(
|
||||
adjustedRequestParams.isReturnAllResults());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user