2019-10-03 16:54:05 +00:00
|
|
|
import axios from "axios";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
2019-10-04 14:13:29 +00:00
|
|
|
async search(term) {
|
2019-10-03 16:54:05 +00:00
|
|
|
// solr endpoint
|
|
|
|
// const host = 'http://voyagerdemo.com/';
|
2019-10-04 14:13:29 +00:00
|
|
|
const host = 'https://repository.geologie.ac.at/';
|
2019-10-03 16:54:05 +00:00
|
|
|
const path = 'solr/rdr_data/select';
|
|
|
|
const fields = 'id,server_date_published,abstract_output,title_output,title_additional,author,subject'; // fields we want returned
|
2019-10-04 14:13:29 +00:00
|
|
|
const dismaxFields = "title^3 abstract^2 subject^1";
|
2019-10-03 16:54:05 +00:00
|
|
|
const facetFields = "facet.field=language";//&fq=year:(2019)";//&facet.query=year:2018";
|
2019-10-04 14:13:29 +00:00
|
|
|
|
2019-10-03 16:54:05 +00:00
|
|
|
// $dismax->setQueryFields('title^3 abstract^2 subject^1');
|
|
|
|
const api = `${host}${path}?defType=dismax&q=${term}&fl=${fields}&qf=${dismaxFields}&facet=on&${facetFields}&wt=json&rows=20&indent=on`;
|
2019-10-04 14:13:29 +00:00
|
|
|
|
|
|
|
const res = await axios.get(api);
|
2019-10-03 16:54:05 +00:00
|
|
|
return res.data;//.response;//.docs;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|