mirror of https://github.com/halo-dev/halo
Fix the problem of null type of search result (#6241)
#### What type of PR is this? /kind bug /area core /milestone 2.17.0 #### What this PR does / why we need it: This PR adds missed type to HaloDocument while converting. #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/6235 #### Does this PR introduce a user-facing change? ```release-note None ```pull/6191/head^2
parent
4ea4bdf8b5
commit
bbc6f23b2d
|
@ -348,6 +348,7 @@ public class LuceneSearchEngine implements SearchEngine, InitializingBean, Dispo
|
|||
public HaloDocument convert(Document doc) {
|
||||
var haloDoc = new HaloDocument();
|
||||
haloDoc.setId(doc.get("id"));
|
||||
haloDoc.setType(doc.get("type"));
|
||||
haloDoc.setMetadataName(doc.get("name"));
|
||||
haloDoc.setTitle(doc.get("title"));
|
||||
haloDoc.setDescription(doc.get("description"));
|
||||
|
|
|
@ -102,6 +102,7 @@ public class LuceneSearchEngineIntegrationTest {
|
|||
assertEquals(1, hits.size());
|
||||
var doc = hits.get(0);
|
||||
assertEquals("post.content.halo.run-first-post", doc.getId());
|
||||
assertEquals("post.content.halo.run", doc.getType());
|
||||
assertEquals("first <my-tag>halo</my-tag> post", doc.getTitle());
|
||||
assertNull(doc.getDescription());
|
||||
assertEquals("<my-tag>halo</my-tag>", doc.getContent());
|
||||
|
|
Loading…
Reference in New Issue