- composer updates

- dynamical connection string to solr for the search via .env-file: settings for SOLR_HOST und SOLR_CORE
This commit is contained in:
Arno Kaimbacher 2020-06-02 16:11:07 +02:00
parent 3fd4a66fbf
commit c0e381ba3a
7 changed files with 315 additions and 249 deletions

View file

@ -7,6 +7,13 @@ import VsPagination from './search-results/vs-pagination.vue';
import rdrApi from './search-results/dataservice';
import FilterItem from './models/filter-item';
interface SolrSettings {
core: string;
host: string;
}
// declare var solrCore: string;
declare var SOLR: SolrSettings;
@Component({
components: {
VsInput,
@ -31,10 +38,12 @@ export default class App extends Vue {
};
loaded = false;
numFound: number;
solrCore: string = SOLR.core;
solrHost: string = SOLR.host;
async onPaginate(start: number): Promise<void> {
// console.log(start);
var res = await rdrApi.search(this.searchTerm, this.activeFilterCategories, start.toString());
var res = await rdrApi.search(this.searchTerm, this.activeFilterCategories, this.solrCore, this.solrHost, start.toString());
this.results = res.response.docs;
}
@ -42,7 +51,7 @@ export default class App extends Vue {
// alert(categoryName);
delete this.activeFilterCategories[categoryName];
var res = await rdrApi.search(this.searchTerm, this.activeFilterCategories);
var res = await rdrApi.search(this.searchTerm, this.activeFilterCategories, this.solrCore, this.solrHost);
this.results = res.response.docs;
this.numFound = res.response.numFound;
@ -96,7 +105,7 @@ export default class App extends Vue {
if (!this.activeFilterCategories[filter.Category].some(e => e === filter.value)) {
this.activeFilterCategories[filter.Category].push(filter.value);
// alert(this.activeFilterCategories[filter.Category]);
var res = await rdrApi.search(this.searchTerm, this.activeFilterCategories);
var res = await rdrApi.search(this.searchTerm, this.activeFilterCategories, this.solrCore, this.solrHost);
this.results = res.response.docs;
this.numFound = res.response.numFound;
@ -148,7 +157,7 @@ export default class App extends Vue {
// }
this.facets = {};
this.searchTerm = term;
var res = await rdrApi.search(this.searchTerm, this.activeFilterCategories);
var res = await rdrApi.search(this.searchTerm, this.activeFilterCategories, this.solrCore, this.solrHost);
this.results = res.response.docs;
this.numFound = res.response.numFound;
@ -177,7 +186,7 @@ export default class App extends Vue {
}
// When the window loads, read query parameters and perform search
async mounted() {
async mounted() {
var query = this.getParameterByName("q");
if (query) query = query.trim();
await this.onSearch("*%3A*");

View file

@ -14,11 +14,12 @@ var SOLR_CONFIG = {
export default {
async search(term: string, filterItems: Object, start?: string): Promise<any> {
async search(term: string, filterItems: Object, solrCore: string, solrHost: string, start?: string): Promise<any> {
// solr endpoint
// const host = 'http://voyagerdemo.com/';
const host = 'https://repository.geologie.ac.at/';
const path = 'solr/rdr_data/select?';
//const host = 'https://www.tethys.at/';
const host = 'https://' + solrHost;
const path = '/solr/' + solrCore + '/select?';
var base = host + path;
//const fields = 'id,server_date_published,abstract_output,title_output,title_additional,author,subject'; // fields we want returned
@ -73,11 +74,12 @@ export default {
},
// for the autocomplete search
async searchTerm(term: string): Promise<any> {
async searchTerm(term: string, solrCore: string, solrHost: string): Promise<any> {
// solr endpoint
// const host = 'http://voyagerdemo.com/';
const host = 'https://repository.geologie.ac.at/';
const path = 'solr/rdr_data/select?';
// const host = 'https://www.tethys.at/';''
const host = 'https://' + solrHost;
const path = '/solr/' + solrCore + '/select?';
var base = host + path;
//const fields = 'id,server_date_published,abstract_output,title_output,title_additional,author,subject'; // fields we want returned

View file

@ -3,7 +3,11 @@ import { Component, Prop } from 'vue-property-decorator';
import debounce from 'lodash/debounce';
import rdrApi from '../search-results/dataservice';
interface SolrSettings {
core: string;
host: string;
}
declare var SOLR: SolrSettings;
@Component({})
export default class VsInput extends Vue {
@ -27,6 +31,8 @@ export default class VsInput extends Vue {
selectedIndex: number = null;
selectedDisplay = null;
isFocussed: boolean = false;
solrCore: string = SOLR.core;
solrHost: string = SOLR.host;
// get results() {
// return this.items;
@ -127,7 +133,7 @@ export default class VsInput extends Vue {
async request() {
try {
var res = await rdrApi.searchTerm(this.display);
var res = await rdrApi.searchTerm(this.display, this.solrCore, this.solrHost);
this.error = null
this.results = res.response.docs;
this.loading = false;

View file

@ -161,6 +161,12 @@
@endsection
@section('after-scripts')
{{-- <script type="text/javascript" src="{{ asset('js/search/main.js') }}"></script> --}}
<script>
const SOLR = <?php echo json_encode([
'core' => config('solarium.endpoint.repository.core'),
'host' => config('solarium.endpoint.repository.host'),
]); ?>
</script>
<script type="text/javascript" src="{{ asset('js/search/main.js') }}"></script>
@stop