Gossamer Forum
Home : Products : Links 2.0 : Customization :

Adaptive search results for reviews

Quote Reply
Adaptive search results for reviews
I have been building and testing a Links for editor review
sites, mainly using modifications from Resources or
suggestions in this forum.

Each site either has
* a full review
* an incomplete review
* no review

I have added two new fields:
* Review (text field)
* isReviewed (boolean)

When the review is finished, the editor sets the isReviewed
flag to 'Yes'. This allows the Review page to be built, and
to be publicly visible by inserting this into link.html ...

<%if isReviewed%>
<A HREF="/links/Reviews/<%ID%>.html">Review</A>
<%endif%>

Thanks to all the helpful people here, it has been very
easy to do. Everything works.

Now I would like to adjust search results to make them more
user-friendly.

What search.cgi does now is this ...

* Checks the fields in array search_fields (links.def),
including of course the Review field.
* Flags records which contain the search term.
* Sorts the records.
* Displays the results using link.html, with keywords
in bold face.

But search terms will often be found in the review, so
instead of using the regular link.html, I use a variant
named searchlink.html, which displays the review in the
search results ...

<%if isReviewed%>
From the review page ...
<BR>
<%Review%>
<%endif%>

As some reviews could be quite long, I would prefer to show
the review only if it included the search term -- or
alternatively, show users a message like

Your keywords were found in the <A HREF="/links/Reviews/<%ID%>.html">Review</A>

In a nutshell, I would like the search results to show
fields that contain the search term, and ignore those
that do not (except for the link title).


This would mean building the search results HTML in a
completely different way. Instead of just flagging records,
individual fields within records would also have to be
flagged. Template-based output can't do it.

I have looked at the search.cgi code, but I cannot see how
this can be done without a substantial rewrite.

I have checked this forum for previous related discussion,
but have found nothing. Has anyone else tried to do this?