Skip to main content.
home | support | download

Back to List Archive

Customizing the results page - display_props not being used

From: David Fishburn <fishburn(at)not-real.ianywhere.com>
Date: Thu Dec 04 2003 - 21:03:35 GMT
Versions:
Linux fishburn-RH9 2.4.20-20.9 #1 Mon Aug 18 11:45:58 EDT 2003 i686 i686
i386 GNU/Linux SWISH-E 2.4.0 
This is perl, v5.8.0 built for i386-linux-thread-multi (with 1
registered patch, see perl -V for more detail)

I have a default install of 2.4.0 into /usr/bin, not /usr/local/bin.

I am trying to display my own Properties on the results page.
This never works.

This is fairly long output, I wanted to ensure you had all the research
I have performed.


In my .swishcgi.conf I have:
********************************
        # Property names listed here will be displayed in a table below
each
        # result You may wish to modify this list if you are using
document
        # properties (PropertyNames) in your swish-e index configuration
There
        # is no default.

        display_props   => [qw/ami_title ami_description
swishlastmodified swishdocsize swishdocpath/],
********************************

So I am overriding which properties I want to display.

When I run swish.cgi, and show the command line I see (all on 1 line):
********************************
/usr/bin/swish-e -H 9 -w swishdefault=(weather) -s swishrank desc
swishlastmodified desc -m 15 -x
"<swishreccount>\t<ami_title>\t<ami_description>\t<ami_title>\t<ami_desc
ription>\t<swishlastmodified>\t<swishdocsize>\t<swishdocpath>\t<swishdoc
path>\t<swishrank>\n" -f
/home/fishburn/dev/ami/scripts/searchtest/swishe/index.swish-e -b 1

And the output when I run this from a terminal:
# SWISH format: 2.4.0
# Search words: swishdefault=(weather)
#
# Index File:
/home/fishburn/dev/ami/scripts/searchtest/swishe/index.swish-e
# Name:
# Saved as: index.swish-e
# Total Words: 10509
# Total Files: 1422
# Indexed on: 2003-12-04 08:48:58 PST
# Description:
# Pointer:
# Maintained by:
# MinWordLimit: 1
# MaxWordLimit: 40
# WordCharacters:
0123456789abcdefghijklmnopqrstuvwxyz

# BeginCharacters:
0123456789abcdefghijklmnopqrstuvwxyz

# EndCharacters:
0123456789abcdefghijklmnopqrstuvwxyz

# IgnoreFirstChar:
# IgnoreLastChar:
# StopWords:
# BuzzWords:
# Stemming Applied: 0
# Soundex Applied: 0
# Fuzzy Mode: None
# IgnoreTotalWordCountWhenRanking: 1
# Search words: swishdefault=(weather)
# Parsed Words: swishdefault = ( weather )
# Removed stopwords:
#
# Number of hits: 2
# Search time: 0.001 seconds
# Run time: 0.090 seconds
1       Cupitt Aviation Mobile Weather  Personalized mobile weather for
pilots a
nd aviation enthusiasts.  Current METAR/TAF, Area Forecasts, Winds Aloft
Forecas
t, SIGMETs, AIRMETS, and more.  Cupitt Aviation Mobile Weather
Personalized mob
ile weather for pilots and aviation enthusiasts.  Current METAR/TAF,
Area Foreca
sts, Winds Aloft Forecast, SIGMETs, AIRMETS, and more.  2003-12-04
11:47:50 EST
584     http://gotohellcarolina.com/weather/
http://gotohellcarolina.com/weather/    1000
2       CorpusChristi Caller-Times' Caller Mobile      Corpus Christi
Caller-Ti
mes' wireless version, Caller Mobile, covers local, Coastal Bend, Texas,
nationa
l news, sports, business, opinions and more. Coverage includes
Kingsville and ot
her South Texas cities. CorpusChristi Caller-Times' Caller Mobile
Corpus C
hristi Caller-Times' wireless version, Caller Mobile, covers local,
Coastal Bend
, Texas, national news, sports, business, opinions and more. Coverage
includes K
ingsville and other South Texas cities. 2003-12-04 11:48:10 EST 40995
https://
www.caller2.com/mobilesignup.cfm?
https://www.caller2.com/mobilesignup.cfm
?       299
.
********************************

The important part of the above, is I see the data of the Property field
I was looking for.
I could run this slightly differently:
********************************
$ /usr/bin/swish-e -w swishdefault=(weather) -s swishrank desc
swishlastmodified desc -m 15 -x "ami_description=<ami_description>\n" -f
/home/fishburn/dev/ami/scripts/searchtest/swishe/index.swish-e -b 1
# SWISH format: 2.4.0
# Search words: swishdefault=(weather)
# Removed stopwords:
# Number of hits: 2
# Search time: 0.001 seconds
# Run time: 0.086 seconds
ami_description=Personalized mobile weather for pilots and aviation
enthusiasts.  Current METAR/TAF, Area Forecasts, Winds Aloft Forecast,
SIGMETs, AIRMETS, and more.
ami_description=Corpus Christi Caller-Times' wireless version, Caller
Mobile, covers local, Coastal Bend, Texas, national news, sports,
business, opinions and more. Coverage includes Kingsville and other
South Texas cities.
.
********************************

So, when I have this in my .swishcgi.conf file:
        display_props   => [qw/ami_title ami_description
swishlastmodified swishdocsize swishdocpath/],

I expected to see the ami_description field displayed.
But I get nothing, for it, or the ami_title field.
These properties are displayed correctly:
swishlastmodified swishdocsize swishdocpath

In my swish.conf file I have:
********************************
# Meta tags to identify what has been indexed, this allows
# you to limit your search to certain fields:
# swish-e -w ami_categories=Technology
MetaNames ami_channel_id ami_title ami_keywords ami_description
ami_categories swishtitle swishdocpath


# Allows you to specify certain META tags that can be used as document
# properties. The contents of any META tag that has been identified as a
# document property can be returned as part of the search results
PropertyNames ami_title ami_categories ami_description
********************************

Which you can tell since the output from the swish-e command had the
appropriate output.


I am using the SWISH::TemplateHTMLTemplate.

In the results section of this file, there is this section:
********************************
            <TMPL_LOOP FILES>
                <dl>
                    <dt><a href="<TMPL_VAR swishdocpath_href>"><TMPL_VAR
swishti
tle></a> <small>-- rank: <b><TMPL_VAR swishrank></b></small></dt>
                    <dd><TMPL_VAR swishdescription>...<br>

                    <TMPL_IF PROPERTIES>
                        <p>
                        <TMPL_LOOP PROPERTIES>
                        <br> hello
                            <b><TMPL_VAR PROP_NAME></b>: <TMPL_VAR
PROP_VALUE><b
r>
                        </TMPL_LOOP>
                    </TMPL_IF>

                    <br>checking properties</br>
                    <TMPL_IF PROPERTIES>
                            <br>has properties</br>
                        <select name="display_props">
                            <TMPL_LOOP SORTS>
                                <b><TMPL_VAR NAME></b>: <TMPL_VAR
LABEL><br>
                            </TMPL_LOOP>
                        </select>
                    </TMPL_IF>


                    <small>
                        <TMPL_VAR swishdocpath>
                        <TMPL_VAR swishlastmodified>
                        <TMPL_VAR swishdocsize> bytes.
                    </small>
                    </dd>
                </dl>
********************************


This section should cause those elements to be displayed:
********************************
                    <TMPL_IF PROPERTIES>
                        <p>
                        <TMPL_LOOP PROPERTIES>
                        <br> hello
                            <b><TMPL_VAR PROP_NAME></b>: <TMPL_VAR
PROP_VALUE><b
r>
                        </TMPL_LOOP>
                    </TMPL_IF>
********************************

Just to make sure, I added this part to it (just below):
********************************
                    <br>checking properties</br>
                    <TMPL_IF PROPERTIES>
                            <br>has properties</br>
                        <select name="display_props">
                            <TMPL_LOOP SORTS>
                                <b><TMPL_VAR NAME></b>: <TMPL_VAR
LABEL><br>
                            </TMPL_LOOP>
                        </select>
                    </TMPL_IF>
********************************
"checking properties" is displayed on the swish.cgi output, but this is
not: "has properties"


So this lead me to the TemplateHTMLTemplate.pm.
********************************
    my $MapNames  = $results->config('name_labels') || {};
    my $Sorts     = $results->config('sorts');
    my $MetaNames = $results->config('metanames');

    $params->{SORTS} = [ map { { NAME => $_, LABEL => ($MapNames->{$_}
|| $_) }
} @$Sorts ] if $Sorts;
********************************

The above lines appear to setup the <TMPL_IF SORTS> ... template.

I did not see anything for the display_props, so I added the following
lines:
********************************
my $DispProps = $results->config('display_props');
 $params->{PROPERTIES} = [ map { { NAME => $_, LABEL => ($MapNames->{$_}
|| $
_) } } @$DispProps ] if $DispProps;
********************************

But that did not help.

I did confirm that $DispProps was successfully populated in this script.
Name_lables is in my .swishcgi.conf file and is defined as:
********************************
name_labels => {
    swishdefault        => 'Title & Body',
    swishtitle          => 'Title',
    swishrank           => 'Rank',
    swishlastmodified   => 'Last Modified Date',
    swishdocpath        => 'Document Path',
    swishdocsize        => 'Document Size',
    all                 => 'All',              # group of metanames
    subject             => 'Message Subject',  # other examples
    name                => "Poster's Name",
    email               => "Poster's Email",
    sent                => 'Message Date',
    ami_title           => 'Title',
    ami_channel_id      => 'Channel ID',
    ami_keywords        => 'Keywords',
    ami_description     => 'Description',
    ami_categories      => 'Category',
},
********************************
Which has the required ami_title and ami_description elements.


Can anyone see what the problem (and better yet how to correct it) is.

TIA,
Dave
Received on Thu Dec 4 21:03:47 2003