2021-03-27 03:35:27 +01:00
|
|
|
package it.cavallium.dbengine.database;
|
|
|
|
|
2021-08-04 01:12:39 +02:00
|
|
|
import it.cavallium.dbengine.client.query.current.data.TotalHitsCount;
|
2022-07-23 14:25:59 +02:00
|
|
|
import it.cavallium.dbengine.lucene.LuceneCloseable;
|
2022-06-14 18:05:26 +02:00
|
|
|
import it.cavallium.dbengine.utils.SimpleResource;
|
2022-07-23 14:25:59 +02:00
|
|
|
import java.util.List;
|
2021-08-24 11:53:19 +02:00
|
|
|
import java.util.Objects;
|
2023-02-09 23:34:25 +01:00
|
|
|
import java.util.stream.Stream;
|
2021-12-17 01:48:49 +01:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
import org.apache.logging.log4j.Logger;
|
2021-03-27 03:35:27 +01:00
|
|
|
|
2023-02-26 21:41:20 +01:00
|
|
|
public class LLSearchResultShard {
|
2021-08-24 11:53:19 +02:00
|
|
|
|
2022-07-23 14:25:59 +02:00
|
|
|
private static final Logger LOG = LogManager.getLogger(LLSearchResultShard.class);
|
2021-08-24 11:53:19 +02:00
|
|
|
|
2023-02-26 21:41:20 +01:00
|
|
|
private final List<LLKeyScore> results;
|
2022-06-14 18:05:26 +02:00
|
|
|
private final TotalHitsCount totalHitsCount;
|
2021-08-24 11:53:19 +02:00
|
|
|
|
2023-02-26 21:41:20 +01:00
|
|
|
public LLSearchResultShard(List<LLKeyScore> results, TotalHitsCount totalHitsCount) {
|
2021-08-24 11:53:19 +02:00
|
|
|
this.results = results;
|
|
|
|
this.totalHitsCount = totalHitsCount;
|
2022-07-23 14:25:59 +02:00
|
|
|
}
|
|
|
|
|
2023-02-26 21:41:20 +01:00
|
|
|
public List<LLKeyScore> results() {
|
2021-08-24 11:53:19 +02:00
|
|
|
return results;
|
|
|
|
}
|
|
|
|
|
|
|
|
public TotalHitsCount totalHitsCount() {
|
|
|
|
return totalHitsCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (obj == this)
|
|
|
|
return true;
|
|
|
|
if (obj == null || obj.getClass() != this.getClass())
|
|
|
|
return false;
|
|
|
|
var that = (LLSearchResultShard) obj;
|
2021-09-18 18:34:21 +02:00
|
|
|
return Objects.equals(this.results, that.results) && Objects.equals(this.totalHitsCount, that.totalHitsCount);
|
2021-08-24 11:53:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
2021-09-18 18:34:21 +02:00
|
|
|
return Objects.hash(results, totalHitsCount);
|
2021-08-24 11:53:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
2021-09-18 18:34:21 +02:00
|
|
|
return "LLSearchResultShard[" + "results=" + results + ", " + "totalHitsCount=" + totalHitsCount + ']';
|
2021-08-24 11:53:19 +02:00
|
|
|
}
|
|
|
|
}
|