update sample queries for combo fields
authorBill Erickson <berickxx@gmail.com>
Fri, 13 Sep 2019 20:11:48 +0000 (16:11 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 22 Oct 2019 13:18:21 +0000 (09:18 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/catalog/elastic.service.ts
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Elastic.pm
Open-ILS/src/support-scripts/test-scripts/elastic-search-samples.pl
Open-ILS/src/support-scripts/test-scripts/elastic-search.pl

index f956ca2..8df8f56 100644 (file)
@@ -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);
 
index da51d3e..90de6fb 100644 (file)
@@ -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');
index fbb182d..dfe38b2 100755 (executable)
@@ -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'
         }
index becf508..7ed760d 100755 (executable)
@@ -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'
             } 
         }
     };