Changeset 32098 for gs3-extensions/solr


Ignore:
Timestamp:
2017-12-12T19:36:16+13:00 (6 years ago)
Author:
ak19
Message:

Fix to solr facets: if there are 2 values assigned for a metadata of a doc, e.g. a doc's subjects meta is set to youth, and another subjects meta for that doc is set to food, it used to appear under solr's subjects facet as a new, single term called 'youth food'. But now each distinct value for that meta is indexed as a separate field with a separate value, despite the same field name (the meta, e.g. subjects). In order for this to work, the schema.xml.in, which gets copied into a solr col's etc/conf folder, needed to specify that the dynamic field for by* is multivalued (previously set to false, now true) to allow many field elements for the same field name. Tested solr-jdbm-demo (and my simple test case). Nothing that wasn't already broken in faceted searching of solr-jdbm-demo appears broken here, but results are still different, which may be expected since there's no accumulated meta value for a doc's metadata anymore.

Location:
gs3-extensions/solr/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/conf/schema.xml.in

    r31859 r32098  
    250250
    251251   <!-- dynamic field for sort/facet fields, which are strings by default. ie not tokenised -->
    252    <dynamicField name="by*" type="string" indexed="true" stored="false" multiValued="false" />
     252   <dynamicField name="by*" type="string" indexed="true" stored="false" multiValued="true" />
    253253
    254254   <!-- uncomment the following to ignore any fields that don't already match an existing
  • gs3-extensions/solr/trunk/src/perllib/solrbuildproc.pm

    r30050 r32098  
    611611        push (@metadata_list, @section_metadata);
    612612        }
    613         my $new_text = "";
     613        # my $new_text = "";
     614        # foreach my $item (@metadata_list) {
     615        #   &ghtml::htmlsafe($item);
     616        #   $new_text .= "$item ";
     617        # }
     618        # if ($new_text =~ /\S/) {
     619        #   $new_text = "<field name=\"$sf_shortname\">$new_text</field>\n";
     620        #   # filter the text???
     621        #   $text .= "$new_text"; # add it to the main text block
     622        #   print "#### new_text: $new_text\n";
     623
     624        #   $self->{'actualsortfields'}->{$sfield} = 1;
     625        # }
     626        # print "#### TEXT: $text\n";
     627
    614628        foreach my $item (@metadata_list) {
    615629        &ghtml::htmlsafe($item);
    616         $new_text .= "$item ";
    617         }
    618         if ($new_text =~ /\S/) {
    619         $new_text = "<field name=\"$sf_shortname\">$new_text</field>\n";
     630       
     631        $item = "<field name=\"$sf_shortname\">$item</field>\n";
    620632        # filter the text???
    621         $text .= "$new_text"; # add it to the main text block
    622         $self->{'actualsortfields'}->{$sfield} = 1;
    623         }
     633        $text .= "$item"; # add it to the main text block
     634        #print "#### new_text: $item\n";
     635        }
     636        if(scalar @metadata_list > 0) {
     637            $self->{'actualsortfields'}->{$sfield} = 1;
     638        }
     639       
    624640    }
    625641    }
Note: See TracChangeset for help on using the changeset viewer.