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(); float getScore();
String getContent();
Map<String, Object> getFields(); Map<String, Object> getFields();
} }

View file

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

View file

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

View file

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

View file

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