在 vespa 中实现自定义搜索器
Implementing custom Searcher in vespa
我已经在 Vespa 中创建了基本搜索应用程序,并实现了 Searcher class。我已经使用我的应用程序一张一张地提供了以下这些文件。
{
"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
}
}
我的搜索器 class 如下:
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
}
}]
}
}
我做错了什么或者我应该怎么做?
要实际搜索内容节点而不是像示例中那样模拟 Hello world 结果,您需要将链 'inherits=vespa' 添加到 [=13= 中的搜索链配置中].
我已经在 Vespa 中创建了基本搜索应用程序,并实现了 Searcher class。我已经使用我的应用程序一张一张地提供了以下这些文件。
{
"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
}
}
我的搜索器 class 如下:
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
}
}]
}
}
我做错了什么或者我应该怎么做?
要实际搜索内容节点而不是像示例中那样模拟 Hello world 结果,您需要将链 'inherits=vespa' 添加到 [=13= 中的搜索链配置中].