From: Bill Erickson Date: Fri, 13 Sep 2019 20:11:48 +0000 (-0400) Subject: update sample queries for combo fields X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fe772bc1fe7f1bdbf892e5dcfc38cd784501299f;p=working%2FEvergreen.git update sample queries for combo fields Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/share/catalog/elastic.service.ts b/Open-ILS/src/eg2/src/app/share/catalog/elastic.service.ts index f956ca2f19..8df8f56877 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/elastic.service.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/elastic.service.ts @@ -70,6 +70,9 @@ export class ElasticService { if (ctx.global) { options.search_depth = this.org.root().ou_type().depth(); } + if (ctx.termSearch.available) { + options.available = true; + } return this.net.request( 'open-ils.search', method, elasticStruct, options @@ -80,7 +83,6 @@ export class ElasticService { const search = new RequestBodySearch(); - search.source(['id']); // only retrieve IDs search.size(ctx.pager.limit); search.from(ctx.pager.offset); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Elastic.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Elastic.pm index da51d3e9eb..90de6fb75d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Elastic.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Elastic.pm @@ -160,10 +160,12 @@ sub bib_search { my $staff = ($self->api_name =~ /staff/); - $logger->info("ES parsing API query $query staff=$staff"); - return {count => 0, ids => []} unless $query && $query->{query}; + # Only ask ES to return the 'id' field from the source bibs in + # the response object, since that's all we need. + $query->{_source} = ['id']; + my $elastic_query = compile_elastic_query($query, $options, $staff); my $es = OpenILS::Elastic::BibSearch->new('main'); diff --git a/Open-ILS/src/support-scripts/test-scripts/elastic-search-samples.pl b/Open-ILS/src/support-scripts/test-scripts/elastic-search-samples.pl index fbb182d7dd..dfe38b2008 100755 --- a/Open-ILS/src/support-scripts/test-scripts/elastic-search-samples.pl +++ b/Open-ILS/src/support-scripts/test-scripts/elastic-search-samples.pl @@ -46,14 +46,14 @@ my $queries = [{ must => [{ multi_match => { query => 'ready', - fields => ['title|*.text*'], + fields => ['title.text*'], operator => 'and', type => 'most_fields' } }, { multi_match => { query => 'puzzle', - fields => ['subject|*.text*'], + fields => ['subject.text*'], operator => 'and', type => 'most_fields' } @@ -83,7 +83,7 @@ my $queries = [{ must => [{ multi_match => { query => 'Cuthbert Morton Girdlestone', - fields => ['author|*text*'], + fields => ['author.text*'], operator => 'and', type => 'most_fields' } diff --git a/Open-ILS/src/support-scripts/test-scripts/elastic-search.pl b/Open-ILS/src/support-scripts/test-scripts/elastic-search.pl index becf508c6d..7ed760debb 100755 --- a/Open-ILS/src/support-scripts/test-scripts/elastic-search.pl +++ b/Open-ILS/src/support-scripts/test-scripts/elastic-search.pl @@ -57,8 +57,9 @@ Some examples: harry potter title|maintitle.text\\*:piano -author|\\*.text\\*:GrandPré -author|\\*.text\\*:(johann brahms) OR (wolfgang mozart) +author.text\\*:GrandPré +au:((johann brahms) OR (wolfgang mozart)) +su:history MESSAGE while (1) { @@ -82,7 +83,7 @@ while (1) { # Combine scores for matched indexes type => 'most_fields', # Search all keyword text indexes by default. - default_field => 'keyword|keyword.text' + default_field => 'keyword.text' } } };