allow access to UTF-8 content in SearchDocument

This commit is contained in:
Jörg Prante 2023-01-29 22:12:52 +01:00
parent 88c550d9c1
commit 8df4681894
5 changed files with 18 additions and 1 deletions

View file

@ -10,5 +10,7 @@ public interface SearchDocument {
float getScore();
String getContent();
Map<String, Object> getFields();
}

View file

@ -28,6 +28,11 @@ public class DefaultSearchDocument implements SearchDocument {
return searchHit.getScore();
}
@Override
public String getContent() {
return searchHit.getSourceRef().utf8ToString();
}
@Override
public Map<String, Object> getFields() {
return searchHit.getSourceAsMap();

View file

@ -27,6 +27,11 @@ public class GetDocument implements SearchDocument {
return -1f;
}
@Override
public String getContent() {
return getResponse.getSourceAsBytesRef().utf8ToString();
}
@Override
public Map<String, Object> getFields() {
return getResponse.getSourceAsMap();

View file

@ -27,6 +27,11 @@ public class MultiGetDocument implements SearchDocument {
return -1f;
}
@Override
public String getContent() {
return getResponse.getResponse().getSourceAsBytesRef().utf8ToString();
}
@Override
public Map<String, Object> getFields() {
return getResponse.getResponse().getSourceAsMap();

View file

@ -1,5 +1,5 @@
group = org.xbib
name = elx
version = 7.10.2.23
version = 7.10.2.24
org.gradle.warning.mode = ALL