mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 19:51:00 +00:00
(feature)(headless)Support offset clause in struct query.
This commit is contained in:
@@ -49,7 +49,8 @@ public class EmbeddingServiceImpl implements EmbeddingService {
|
||||
try {
|
||||
EmbeddingModel embeddingModel = ModelProvider.getEmbeddingModel();
|
||||
Embedding embedding = embeddingModel.embed(question).content();
|
||||
boolean existSegment = existSegment(collectionName,embeddingStore, query, embedding);
|
||||
boolean existSegment =
|
||||
existSegment(collectionName, embeddingStore, query, embedding);
|
||||
if (existSegment) {
|
||||
continue;
|
||||
}
|
||||
@@ -62,14 +63,14 @@ public class EmbeddingServiceImpl implements EmbeddingService {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean existSegment(String collectionName,EmbeddingStore embeddingStore, TextSegment query,
|
||||
Embedding embedding) {
|
||||
private boolean existSegment(String collectionName, EmbeddingStore embeddingStore,
|
||||
TextSegment query, Embedding embedding) {
|
||||
String queryId = TextSegmentConvert.getQueryId(query);
|
||||
if (queryId == null) {
|
||||
return false;
|
||||
}
|
||||
// Check cache first
|
||||
Boolean cachedResult = cache.getIfPresent(collectionName+queryId);
|
||||
Boolean cachedResult = cache.getIfPresent(collectionName + queryId);
|
||||
if (cachedResult != null) {
|
||||
return cachedResult;
|
||||
}
|
||||
@@ -82,7 +83,7 @@ public class EmbeddingServiceImpl implements EmbeddingService {
|
||||
EmbeddingSearchResult result = embeddingStore.search(request);
|
||||
List<EmbeddingMatch<TextSegment>> relevant = result.matches();
|
||||
boolean exists = CollectionUtils.isNotEmpty(relevant);
|
||||
cache.put(collectionName+queryId, exists);
|
||||
cache.put(collectionName + queryId, exists);
|
||||
return exists;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user