better search user interface:

- facets as object properties
- composer updates
This commit is contained in:
Arno Kaimbacher 2019-10-15 13:52:52 +02:00
parent a95282e49e
commit 78a88081c2
8 changed files with 117 additions and 95 deletions

View File

@ -44,7 +44,7 @@ class SolrIndexBuilder extends Command
foreach ($datasets as $dataset) {
$datasetId = $dataset->id;
$time = new \Illuminate\Support\Carbon();
$dataset->server_date_published = $time;
$dataset->server_date_modified = $time;
$dataset->save();
// try {
// // Opus_Search_Service::selectIndexingService('onDocumentChange')

156
composer.lock generated
View File

@ -8,16 +8,16 @@
"packages": [
{
"name": "astrotomic/laravel-translatable",
"version": "v11.5.1",
"version": "v11.5.2",
"source": {
"type": "git",
"url": "https://github.com/Astrotomic/laravel-translatable.git",
"reference": "078a22ea96582f7f518f5418ee7e57e3746fb032"
"reference": "d1496d1f53e40ce6ceb689aa75befea4818211f1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Astrotomic/laravel-translatable/zipball/078a22ea96582f7f518f5418ee7e57e3746fb032",
"reference": "078a22ea96582f7f518f5418ee7e57e3746fb032",
"url": "https://api.github.com/repos/Astrotomic/laravel-translatable/zipball/d1496d1f53e40ce6ceb689aa75befea4818211f1",
"reference": "d1496d1f53e40ce6ceb689aa75befea4818211f1",
"shasum": ""
},
"require": {
@ -68,7 +68,7 @@
"laravel",
"translation"
],
"time": "2019-09-05T13:59:22+00:00"
"time": "2019-10-09T08:24:20+00:00"
},
{
"name": "davejamesmiller/laravel-breadcrumbs",
@ -1005,16 +1005,16 @@
},
{
"name": "league/flysystem",
"version": "1.0.55",
"version": "1.0.56",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "33c91155537c6dc899eacdc54a13ac6303f156e6"
"reference": "90e3f83cb10ef6b058d70f95267030e7a6236518"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/33c91155537c6dc899eacdc54a13ac6303f156e6",
"reference": "33c91155537c6dc899eacdc54a13ac6303f156e6",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/90e3f83cb10ef6b058d70f95267030e7a6236518",
"reference": "90e3f83cb10ef6b058d70f95267030e7a6236518",
"shasum": ""
},
"require": {
@ -1085,24 +1085,24 @@
"sftp",
"storage"
],
"time": "2019-08-24T11:17:19+00:00"
"time": "2019-10-12T13:05:59+00:00"
},
{
"name": "mcamara/laravel-localization",
"version": "1.4.2",
"version": "1.4.3",
"source": {
"type": "git",
"url": "https://github.com/mcamara/laravel-localization.git",
"reference": "d228a61afd8cfe9eb7f8f7450acfa0371382407d"
"reference": "00ed4af3633076e98dc58d317125b7f17d3c64f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mcamara/laravel-localization/zipball/d228a61afd8cfe9eb7f8f7450acfa0371382407d",
"reference": "d228a61afd8cfe9eb7f8f7450acfa0371382407d",
"url": "https://api.github.com/repos/mcamara/laravel-localization/zipball/00ed4af3633076e98dc58d317125b7f17d3c64f4",
"reference": "00ed4af3633076e98dc58d317125b7f17d3c64f4",
"shasum": ""
},
"require": {
"laravel/framework": "~5.2.0||~5.3.0||~5.4.0||~5.5.0||~5.6.0||~5.7.0||~5.8.0||~6.0.0",
"laravel/framework": "~5.2.0||~5.3.0||~5.4.0||~5.5.0||~5.6.0||~5.7.0||~5.8.0||^6.0",
"php": ">=7.1.0"
},
"require-dev": {
@ -1147,7 +1147,7 @@
"localization",
"php"
],
"time": "2019-09-20T15:24:04+00:00"
"time": "2019-10-13T10:19:29+00:00"
},
{
"name": "monolog/monolog",
@ -1919,16 +1919,16 @@
},
{
"name": "symfony/contracts",
"version": "v1.1.6",
"version": "v1.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/contracts.git",
"reference": "3692662d26cd9d204a69748792ae021c35313610"
"reference": "9cb52490dd60e0f50dbcdbdb3a6dbcb31f3a363e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/contracts/zipball/3692662d26cd9d204a69748792ae021c35313610",
"reference": "3692662d26cd9d204a69748792ae021c35313610",
"url": "https://api.github.com/repos/symfony/contracts/zipball/9cb52490dd60e0f50dbcdbdb3a6dbcb31f3a363e",
"reference": "9cb52490dd60e0f50dbcdbdb3a6dbcb31f3a363e",
"shasum": ""
},
"require": {
@ -1992,20 +1992,20 @@
"interoperability",
"standards"
],
"time": "2019-08-21T15:14:41+00:00"
"time": "2019-10-04T21:43:27+00:00"
},
{
"name": "symfony/css-selector",
"version": "v4.3.4",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "c6e5e2a00db768c92c3ae131532af4e1acc7bd03"
"reference": "f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/c6e5e2a00db768c92c3ae131532af4e1acc7bd03",
"reference": "c6e5e2a00db768c92c3ae131532af4e1acc7bd03",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9",
"reference": "f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9",
"shasum": ""
},
"require": {
@ -2045,20 +2045,20 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2019-08-20T14:07:54+00:00"
"time": "2019-10-02T08:36:26+00:00"
},
{
"name": "symfony/debug",
"version": "v4.3.4",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "afcdea44a2e399c1e4b52246ec8d54c715393ced"
"reference": "cc5c1efd0edfcfd10b354750594a46b3dd2afbbe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/afcdea44a2e399c1e4b52246ec8d54c715393ced",
"reference": "afcdea44a2e399c1e4b52246ec8d54c715393ced",
"url": "https://api.github.com/repos/symfony/debug/zipball/cc5c1efd0edfcfd10b354750594a46b3dd2afbbe",
"reference": "cc5c1efd0edfcfd10b354750594a46b3dd2afbbe",
"shasum": ""
},
"require": {
@ -2101,11 +2101,11 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2019-08-20T14:27:59+00:00"
"time": "2019-09-19T15:51:53+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v3.4.31",
"version": "v3.4.32",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
@ -2168,16 +2168,16 @@
},
{
"name": "symfony/finder",
"version": "v4.3.4",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2"
"reference": "5e575faa95548d0586f6bedaeabec259714e44d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/86c1c929f0a4b24812e1eb109262fc3372c8e9f2",
"reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2",
"url": "https://api.github.com/repos/symfony/finder/zipball/5e575faa95548d0586f6bedaeabec259714e44d1",
"reference": "5e575faa95548d0586f6bedaeabec259714e44d1",
"shasum": ""
},
"require": {
@ -2213,20 +2213,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2019-08-14T12:26:46+00:00"
"time": "2019-09-16T11:29:48+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v4.3.4",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "d804bea118ff340a12e22a79f9c7e7eb56b35adc"
"reference": "76590ced16d4674780863471bae10452b79210a5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/d804bea118ff340a12e22a79f9c7e7eb56b35adc",
"reference": "d804bea118ff340a12e22a79f9c7e7eb56b35adc",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/76590ced16d4674780863471bae10452b79210a5",
"reference": "76590ced16d4674780863471bae10452b79210a5",
"shasum": ""
},
"require": {
@ -2268,7 +2268,7 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2019-08-26T08:55:16+00:00"
"time": "2019-10-04T19:48:13+00:00"
},
{
"name": "symfony/http-kernel",
@ -2359,16 +2359,16 @@
},
{
"name": "symfony/mime",
"version": "v4.3.4",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "987a05df1c6ac259b34008b932551353f4f408df"
"reference": "32f71570547b91879fdbd9cf50317d556ae86916"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/987a05df1c6ac259b34008b932551353f4f408df",
"reference": "987a05df1c6ac259b34008b932551353f4f408df",
"url": "https://api.github.com/repos/symfony/mime/zipball/32f71570547b91879fdbd9cf50317d556ae86916",
"reference": "32f71570547b91879fdbd9cf50317d556ae86916",
"shasum": ""
},
"require": {
@ -2414,7 +2414,7 @@
"mime",
"mime-type"
],
"time": "2019-08-22T08:16:11+00:00"
"time": "2019-09-19T17:00:15+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -2711,16 +2711,16 @@
},
{
"name": "symfony/process",
"version": "v4.3.4",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "e89969c00d762349f078db1128506f7f3dcc0d4a"
"reference": "50556892f3cc47d4200bfd1075314139c4c9ff4b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/e89969c00d762349f078db1128506f7f3dcc0d4a",
"reference": "e89969c00d762349f078db1128506f7f3dcc0d4a",
"url": "https://api.github.com/repos/symfony/process/zipball/50556892f3cc47d4200bfd1075314139c4c9ff4b",
"reference": "50556892f3cc47d4200bfd1075314139c4c9ff4b",
"shasum": ""
},
"require": {
@ -2756,20 +2756,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2019-08-26T08:26:39+00:00"
"time": "2019-09-26T21:17:10+00:00"
},
{
"name": "symfony/routing",
"version": "v4.3.4",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "ff1049f6232dc5b6023b1ff1c6de56f82bcd264f"
"reference": "3b174ef04fe66696524efad1e5f7a6c663d822ea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/ff1049f6232dc5b6023b1ff1c6de56f82bcd264f",
"reference": "ff1049f6232dc5b6023b1ff1c6de56f82bcd264f",
"url": "https://api.github.com/repos/symfony/routing/zipball/3b174ef04fe66696524efad1e5f7a6c663d822ea",
"reference": "3b174ef04fe66696524efad1e5f7a6c663d822ea",
"shasum": ""
},
"require": {
@ -2832,20 +2832,20 @@
"uri",
"url"
],
"time": "2019-08-26T08:26:39+00:00"
"time": "2019-10-04T20:57:10+00:00"
},
{
"name": "symfony/translation",
"version": "v4.3.4",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "28498169dd334095fa981827992f3a24d50fed0f"
"reference": "fe6193b066c457c144333c06aaa869a2d42a167f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/28498169dd334095fa981827992f3a24d50fed0f",
"reference": "28498169dd334095fa981827992f3a24d50fed0f",
"url": "https://api.github.com/repos/symfony/translation/zipball/fe6193b066c457c144333c06aaa869a2d42a167f",
"reference": "fe6193b066c457c144333c06aaa869a2d42a167f",
"shasum": ""
},
"require": {
@ -2908,20 +2908,20 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2019-08-26T08:55:16+00:00"
"time": "2019-09-27T14:37:39+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v4.3.4",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "641043e0f3e615990a0f29479f9c117e8a6698c6"
"reference": "bde8957fc415fdc6964f33916a3755737744ff05"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/641043e0f3e615990a0f29479f9c117e8a6698c6",
"reference": "641043e0f3e615990a0f29479f9c117e8a6698c6",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/bde8957fc415fdc6964f33916a3755737744ff05",
"reference": "bde8957fc415fdc6964f33916a3755737744ff05",
"shasum": ""
},
"require": {
@ -2984,7 +2984,7 @@
"debug",
"dump"
],
"time": "2019-08-26T08:26:39+00:00"
"time": "2019-10-04T19:48:13+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
@ -3643,22 +3643,22 @@
},
{
"name": "phpspec/prophecy",
"version": "1.8.1",
"version": "1.9.0",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76"
"reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76",
"reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203",
"reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0",
"sebastian/comparator": "^1.1|^2.0|^3.0",
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
},
@ -3702,7 +3702,7 @@
"spy",
"stub"
],
"time": "2019-06-13T12:50:23+00:00"
"time": "2019-10-03T11:07:50+00:00"
},
{
"name": "phpunit/php-code-coverage",
@ -4608,16 +4608,16 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.4.2",
"version": "3.5.0",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8"
"reference": "0afebf16a2e7f1e434920fa976253576151effe9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
"reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/0afebf16a2e7f1e434920fa976253576151effe9",
"reference": "0afebf16a2e7f1e434920fa976253576151effe9",
"shasum": ""
},
"require": {
@ -4655,7 +4655,7 @@
"phpcs",
"standards"
],
"time": "2019-04-10T23:49:02+00:00"
"time": "2019-09-26T23:12:26+00:00"
},
{
"name": "theseer/tokenizer",

View File

@ -9,5 +9,5 @@ return [
'core' => env('SOLR_CORE', 'rdr_data')
]
],
'xsltfile' => "public/solr.xslt"
'xsltfile' => "solr.xslt"
];

File diff suppressed because one or more lines are too long

View File

@ -9,8 +9,9 @@
</div>-->
<!-- <facet-list v-bind:data="facets"></facet-list> -->
<div class="card" v-for="(item, index) in facets" :key="index">
<facet-list :data="item.values" :filterName="item.filterName" @filter="onFilter"></facet-list>
<!-- <div class="card" v-for="(item, index) in facets" :key="index"> -->
<div class="card" v-for="(values, key, index) in facets" :key="index">
<facet-list :data="values" :filterName="key" @filter="onFilter"></facet-list>
</div>
</div>
</div>

View File

@ -15,7 +15,7 @@ import FilterItem from './models/filter-item';
export default class App extends Vue {
results = [];
facets = [];
facets = {};
searchTerm = '';
activeFilterItems = {};
@ -32,20 +32,33 @@ export default class App extends Vue {
var res = await rdrApi.search(this.searchTerm, this.activeFilterItems);
this.results = res.response.docs;
// this.facets = res.facet_counts.facet_fields;
this.facets = [];
// this.facets = [];
var facet_fields = res.facet_counts.facet_fields;
for (var prop in facet_fields) {
var facetValues = facet_fields[prop].map((facet, i) => {
var facetValues = facet_fields[prop].map((facetValue, i) => {
if (i % 2 === 0) {
// var rObj = { value: facet, count: facet_fields[prop][i + 1] };
var rObj = new FilterItem(facet, facet_fields[prop][i + 1]);
// var rObj = { value: facetValue, count: facet_fields[prop][i + 1] };
var rObj;
if (filter.value == facetValue) {
rObj = filter;
} else if( this.facets[prop].some(e => e.value === facetValue)) {
console.log(facetValue + " is included")
var indexOfFacetValue = this.facets[prop].findIndex(i => i.value === facetValue);
console.log(indexOfFacetValue);
rObj = this.facets[prop][indexOfFacetValue];
rObj.count = facet_fields[prop][i + 1];
} else {
rObj = new FilterItem(facetValue, facet_fields[prop][i + 1]);
}
return rObj;
}
}).filter(function (el) {
return el != null && el.count > 0;
});
this.facets.push({ filterName: prop, values: facetValues });
// this.facets.push({ filterName: prop, values: facetValues });
this.facets[prop] = facetValues;
}
}
}
@ -55,9 +68,10 @@ export default class App extends Vue {
// this.activeFilterItems.pop();
// }
this.activeFilterItems = {};
while (this.facets.length > 0) {
this.facets.pop();
}
// while (this.facets.length > 0) {
// this.facets.pop();
// }
this.facets = {};
this.searchTerm = term;
var res = await rdrApi.search(this.searchTerm, this.activeFilterItems);
this.results = res.response.docs;
@ -72,7 +86,8 @@ export default class App extends Vue {
}).filter(function (el) {
return el != null && el.count > 0;
});
this.facets.push({ filterName: prop, values: facetValues });
//this.facets.push({ filterName: prop, values: facetValues });
this.facets[prop] = facetValues;
}
// console.log(this.facets.toString());
}

View File

@ -19,6 +19,9 @@ export default class FilterItem {
this.category = theCategory;
}
get Active() {
return this.active;
}
set Active(isActive) {
this.active = isActive;
}

View File

@ -17,7 +17,7 @@
<label :for="item.value">
<span click: @click="activateItem(item)">{{ item.value }} ({{ item.count }})</span>
</label>-->
<a :class="Active ? 'disabled' : ''" @click.prevent="activateItem(item)">{{ item.value }} ({{ item.count }})</a>
<a :class="item.Active ? 'disabled' : ''" @click.prevent="activateItem(item)">{{ item.value }} ({{ item.count }})</a>
</li>
</ul>
<ul class="overflowing" v-if="overflowing == true">
@ -36,7 +36,10 @@ export default FacetList;
<style scoped>
/* local styles */
.disabled {
color: lightgrey;
/* background: #dddddd; */
/* color: #EBEBE4; */
color:#ffffff;
pointer-events: none;
text-decoration:line-through;
}
</style>