- .panel-title: capitalize
- bind sevaal filter-viewmodel - better dataservice with datatype facet
This commit is contained in:
parent
961c99adc1
commit
c596a620cc
1
public/css/search_style.css
vendored
1
public/css/search_style.css
vendored
|
@ -22,6 +22,7 @@ section.search {
|
||||||
/* Seasrch items */
|
/* Seasrch items */
|
||||||
|
|
||||||
.left-bar .panel-title {
|
.left-bar .panel-title {
|
||||||
|
text-transform: capitalize;
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,10 @@
|
||||||
<span>{{ item }}</span>
|
<span>{{ item }}</span>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
<facet-list v-bind:data="facets"></facet-list>
|
<!-- <facet-list v-bind:data="facets"></facet-list> -->
|
||||||
|
<div class="card" v-for="(valueArray, filterName, index) in facets" :key="index">
|
||||||
|
<facet-list :data="valueArray" :filterName="filterName"></facet-list>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ export default class App extends Vue {
|
||||||
|
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log('Component mounted.')
|
// console.log('Component mounted.')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@ export default {
|
||||||
const path = 'solr/rdr_data/select';
|
const path = 'solr/rdr_data/select';
|
||||||
const fields = 'id,server_date_published,abstract_output,title_output,title_additional,author,subject'; // fields we want returned
|
const fields = 'id,server_date_published,abstract_output,title_output,title_additional,author,subject'; // fields we want returned
|
||||||
const dismaxFields = "title^3 abstract^2 subject^1";
|
const dismaxFields = "title^3 abstract^2 subject^1";
|
||||||
const facetFields = "facet.field=language";//&fq=year:(2019)";//&facet.query=year:2018";
|
const facetFields = "facet.field=language&facet.field={!key=datatype}doctype";//&fq=year:(2019)";//&facet.query=year:2018";
|
||||||
|
|
||||||
// $dismax->setQueryFields('title^3 abstract^2 subject^1');
|
// $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`;
|
const api = `${host}${path}?defType=dismax&q=${term}&fl=${fields}&qf=${dismaxFields}&facet=on&${facetFields}&wt=json&rows=20&indent=on`;
|
||||||
|
|
|
@ -8,17 +8,22 @@ export default class FacetList extends Vue {
|
||||||
|
|
||||||
ITEMS_PER_FILTER = 5;
|
ITEMS_PER_FILTER = 5;
|
||||||
bar = 'bar';
|
bar = 'bar';
|
||||||
|
// filterItems = [];
|
||||||
|
|
||||||
@Prop()
|
@Prop()
|
||||||
data;
|
data;
|
||||||
|
@Prop()
|
||||||
|
filterName;
|
||||||
|
|
||||||
get myLanguageFilters() {
|
get myLanguageFilters() {
|
||||||
var facetValues = this.data.language.map((facet, i) => {
|
// console.log(this.filterName);
|
||||||
|
// console.log(this.data);
|
||||||
|
var facetValues = this.data.map((facet, i) => {
|
||||||
if (i % 2 === 0) {
|
if (i % 2 === 0) {
|
||||||
// var rObj = {};
|
// var rObj = {};
|
||||||
// rObj['value'] = facet;
|
// rObj['value'] = facet;
|
||||||
// rObj['count'] = solrArray[i +1];
|
// rObj['count'] = solrArray[i +1];
|
||||||
var rObj = { value: facet, count: this.data.language[i + 1] };
|
var rObj = { value: facet, count: this.data[i + 1] };
|
||||||
return rObj;
|
return rObj;
|
||||||
}
|
}
|
||||||
}).filter(function (el) {
|
}).filter(function (el) {
|
||||||
|
@ -36,26 +41,27 @@ export default class FacetList extends Vue {
|
||||||
get facets() {
|
get facets() {
|
||||||
return this.data;
|
return this.data;
|
||||||
};
|
};
|
||||||
|
get filterItems() {
|
||||||
mounted() {
|
var facetValues = this.data.map((facet, i) => {
|
||||||
};
|
|
||||||
|
|
||||||
test(solrArray) {
|
|
||||||
//this.facetValues = this.data.language.filter((facet, i) => i % 2 === 0);
|
|
||||||
|
|
||||||
// var facetValues = this.data.language.map((facet, i) => {
|
|
||||||
var facetValues = solrArray.map((facet, i) => {
|
|
||||||
if (i % 2 === 0) {
|
if (i % 2 === 0) {
|
||||||
// var rObj = {};
|
// var rObj = {};
|
||||||
// rObj['value'] = facet;
|
// rObj['value'] = facet;
|
||||||
// rObj['count'] = solrArray[i +1];
|
// rObj['count'] = solrArray[i +1];
|
||||||
var rObj = { value: facet, count: solrArray[i + 1] };
|
var rObj = { value: facet, count: this.data[i + 1] };
|
||||||
return rObj;
|
return rObj;
|
||||||
}
|
}
|
||||||
|
}).filter(function (el) {
|
||||||
|
return el != null && el.count > 0;
|
||||||
});
|
});
|
||||||
|
// var facetValues = this.data.language.filter(function(facet, i) {
|
||||||
|
// return i % 2 === 0;
|
||||||
// this.facetCounts = this.data.filter((facet, i) => i % 2 === 1);
|
// }).map(function (facet, i) {
|
||||||
|
// var rObj = { value: facet, count: this.data.language[i + 1] };
|
||||||
|
// return rObj;
|
||||||
|
// }, this);
|
||||||
return facetValues;
|
return facetValues;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
};
|
||||||
}
|
}
|
|
@ -1,27 +1,34 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<!-- <span>property: {{ filterName }}</span>
|
||||||
<div class="card" v-for="(valueArray, filterName, index) in facets" :key="index">
|
<span>value: {{ myLanguageFilters }}</span>-->
|
||||||
<!-- <span>property: {{ filterName }}</span>
|
|
||||||
<span>value: {{ myLanguageFilters }}</span> -->
|
|
||||||
|
|
||||||
<div class="panel panel-primary">
|
<div class="panel panel-primary">
|
||||||
<h3 class="panel-title">{{ filterName }}</h3> <!-- e.g.language -->
|
<h3 class="panel-title filterViewModelName">{{ filterName }}</h3>
|
||||||
<ul class="filter-items" v-for="(value, index) in myLanguageFilters" :key="index">
|
<!-- e.g.language -->
|
||||||
<li class="active" role="radio">
|
<ul
|
||||||
<input
|
class="filter-items"
|
||||||
class="css-w1gpbi"
|
v-for="(value, index) in myLanguageFilters"
|
||||||
name="language"
|
:key="index"
|
||||||
v-bind:id="value.value"
|
v-bind:class="{'limited':filterItems.length > 1}"
|
||||||
type="radio"
|
>
|
||||||
v-bind:value="value.value"
|
<li class="active" role="radio">
|
||||||
/>
|
<input
|
||||||
<label :for="value.value">
|
class="css-w1gpbi"
|
||||||
<span>{{ value.value }} ({{ value.count }})</span>
|
name="language"
|
||||||
</label>
|
v-bind:id="value.value"
|
||||||
</li>
|
type="radio"
|
||||||
</ul>
|
v-bind:value="value.value"
|
||||||
</div>
|
/>
|
||||||
</div>
|
<label :for="value.value">
|
||||||
|
<span>{{ value.value }} ({{ value.count }})</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="overflowing">
|
||||||
|
<li>
|
||||||
|
<span @click="toggle()"></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user