diff --git a/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/endpoint/impl/PostgresEndpoint.java b/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/endpoint/impl/PostgresEndpoint.java index 4051af94b..6b1e3c960 100644 --- a/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/endpoint/impl/PostgresEndpoint.java +++ b/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/endpoint/impl/PostgresEndpoint.java @@ -48,8 +48,8 @@ public class PostgresEndpoint extends Endpoint { private String documentDate; /** RRF * */ - private int upperLimit; + private RRFWeight textWeight; private RRFWeight similarityWeight; diff --git a/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/client/impl/PostgresClient.java b/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/client/impl/PostgresClient.java index 8e554bc10..6d714a38d 100644 --- a/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/client/impl/PostgresClient.java +++ b/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/client/impl/PostgresClient.java @@ -286,18 +286,14 @@ public EdgeChain> queryRRF(PostgresEndpoint postgre val.setRawText( Objects.nonNull(row.get("raw_text")) ? (String) row.get("raw_text") : null); - val.setFilename( - Objects.nonNull(row.get("filename")) - ? (String) row.get("filename") - : null); - val.setTimestamp( - Objects.nonNull(row.get("timestamp")) - ? ((Timestamp) row.get("timestamp")).toLocalDateTime() - : null); - val.setNamespace( - Objects.nonNull(row.get("namespace")) - ? (String) row.get("namespace") - : null); + val.setFilename( + Objects.nonNull(row.get("filename")) ? (String) row.get("filename") : null); + val.setTimestamp( + Objects.nonNull(row.get("timestamp")) + ? ((Timestamp) row.get("timestamp")).toLocalDateTime() + : null); + val.setNamespace( + Objects.nonNull(row.get("namespace")) ? (String) row.get("namespace") : null); BigDecimal bigDecimal = Objects.nonNull(row.get("rrf_score")) diff --git a/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/enums/OrderRRFBy.java b/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/enums/OrderRRFBy.java index d43d344bc..db857d0e2 100644 --- a/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/enums/OrderRRFBy.java +++ b/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/enums/OrderRRFBy.java @@ -7,6 +7,7 @@ public enum OrderRRFBy { SIMILARITY, // First Ordered by Similarity; then ordered by rrf_score; (similarity preferred, then // relevance) DATE_RANK; // First Ordered by date_rank; then ordered by rrf_score; (freshness preferred, then + // relevance) public static OrderRRFBy fromString(String value) { diff --git a/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/repositories/PostgresClientRepository.java b/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/repositories/PostgresClientRepository.java index c7d709fcb..2c8293dc3 100644 --- a/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/repositories/PostgresClientRepository.java +++ b/FlySpring/edgechain-app/src/main/java/com/edgechain/lib/index/repositories/PostgresClientRepository.java @@ -277,7 +277,8 @@ public List> queryRRF( dateWeight.getBaseWeight().getValue(), dateWeight.getFineTuneWeight())) .append("FROM ( ") .append( - "SELECT sv.id, sv.raw_text, sv.namespace, sv.filename, sv.timestamp, svtm.document_date, svtm.metadata, ") + "SELECT sv.id, sv.raw_text, sv.namespace, sv.filename, sv.timestamp," + + " svtm.document_date, svtm.metadata, ") .append( String.format( "ts_rank_cd(sv.tsv, plainto_tsquery('%s', '%s')) AS text_rank, ", @@ -302,7 +303,8 @@ public List> queryRRF( .append("FROM ") .append( String.format( - "(SELECT id, raw_text, embedding, tsv, namespace, filename, timestamp from %s WHERE namespace = '%s'", + "(SELECT id, raw_text, embedding, tsv, namespace, filename, timestamp from %s WHERE" + + " namespace = '%s'", tableName, namespace)); switch (metric) {