Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions public/js/search/search-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class SearchAdapter {

static list = [
{
{
name: 'lookup',
label: 'Lookup',
factory: this.lookup
Expand All @@ -29,13 +29,21 @@ class SearchAdapter {
static inferResourceTypes(docs) {
// TODO:
}


static lookup($http, endpoint) {
return new SearchAdapter($http, endpoint, function(query) {
return new SearchAdapter($http, endpoint, function (query) {
return `?query=${query}&format=json`;
}, function(response) {
}, function (response) {
var docs = response.data.docs;

docs.forEach(d => {
if (d.id && !d.title) {
const parts = d.id.split("/").filter(Boolean);
d.title = parts.length > 1 ? parts[parts.length - 1] : d.id;
}
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.

SearchAdapter.inferResourceTypes(docs);
return docs;
});
Expand All @@ -53,7 +61,7 @@ class SearchAdapter {
return virtuosoAdapter;
}



async search(query) {
try {
Expand Down