Show
Ignore:
Timestamp:
11.07.2013 16:15:43 (6 years ago)
Author:
kjdon
Message:

adding in facets

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/perllib/solrbuildproc.pm

    r27802 r27815  
    5858} 
    5959 
     60sub set_facetfields { 
     61    my $self = shift (@_); 
     62  
     63    my ($facetfields) = @_; 
     64    $self->{'facetfields'} = (); 
     65    # lets just go through and check for text, allfields, metadata which are only valid for indexes, not for facetfields 
     66    foreach my $s (@$facetfields) { 
     67    if ($s !~ /^(text|allfields|metadata)$/) { 
     68        push (@{$self->{'facetfields'}}, $s); 
     69    } 
     70    } 
     71} 
    6072 
    6173#---- 
     
    557569    if ($self->{'indexing_text'} && ($sec_tag_name ne "" || $doc_section == 1 )) { 
    558570    # add sort fields if there are any 
    559          
    560     foreach my $sfield (@{$self->{'sortfields'}}) { 
     571        my $seenfields = {}; 
     572    foreach my $sfield (@{$self->{'sortfields'}}, @{$self->{'facetfields'}}) { 
     573        print STDERR "sort/facet field = $sfield\n"; 
    561574        # ignore special field rank 
    562575        next if $sfield eq "rank"; 
     576        # ignore any we have already done - we may have duplicates in the sort and facet lists 
     577        next if (defined $seenfields->{$sfield}); 
     578        print STDERR "processing it\n"; 
     579        $seenfields->{$sfield} = 1; 
    563580        my $sf_shortname; 
    564581        if (defined $self->{'sortfieldnamemap'}->{$sfield}) {