我已经在Vespa中创建了Basic搜索应用程序,并实现了Searcher类。我已经使用我的应用程序一张一张地喂了下面这些文件。
{
"fields": {
"album": "Good",
"artist": "Arijit",
"title": "tum ho",
"year": 2017,
"duration": 300
}
}
{
"fields": {
"album": "Good",
"artist": "Atif",
"title": "bewajah",
"year": 2017,
"duration": 300
}
}
{
"fields": {
"album": "bad",
"artist": "Neha",
"title": "tere",
"year": 2017,
"duration": 400
}
}
我的搜索者课程如下:
public class ExampleSearcher extends Searcher {
@Override
public Result search(Query query, Execution execution) {
retrun execution.search(query);
}
}
现在,当我使用API搜索时
http://localhost:8080/search/?album=good OR http://localhost:8080/search/?=good
我得到了结果:
{
"root": {
"id": "toplevel",
"relevance": 1,
"fields": {
"totalCount": 0
}
}
}
但是我应该得到以下结果输出:
{
"root": {
"id": "toplevel",
"relevance": 1,
"fields": {
"totalCount": 2
},
"children": [{
"id": "good",
"relevance": 1,
"fields": {
"album": "Good",
"artist": "Arijit",
"title": "tum ho",
"year": 2017,
"duration": 300
}
}, {
"id": "good",
"relevance": 1,
"fields": {
"album": "Good",
"artist": "Atif",
"title": "bewajah",
"year": 2017,
"duration": 300
}
}]
}
}
我在做错什么或应该怎么做?
答案 0 :(得分:2)
要实际搜索内容节点,而不是像示例中那样仅模拟Hello world结果,您需要将“ inherits = vespa”链添加到services.xml中的搜索链配置中。