The problem:
Using the perl api of Swish-e returns a reasonably relevance ranked set
of record ids (say 150, 75, 225). But not all of the data for the
result set is stored in the swish indexes.
If I request the records individually from the sql database afterwards,
I end up with a significant delay (~.66 seconds per record).
If I request the records collectively (e. g. WHERE ID IN (150, 75, 225))
the results come back quickly but I don't appear to be force the order
of these records (in the normal course of events, they arrive as 75,
150, 225. Swish has the relevant order; the sql database only has the
data. I tried pre-loading more fields into the swish indexes but they
are essentially flat; the data isn't.
Current thinking:
Get full set of records back from sql using DBI and fetchall_arrayref().
Current problem:
I'm having trouble finding a good working example of the form:
=====
while looping through the swish index results
* find sql result "row" whose "id" equals the swish index "id"
* populate a set of strings with the sql columns from
that specific row
pass string to the appropriate transformation function
(to render Dublin Core, mods etc.)
add to XML content string
}
}
return the XML
=====
and in particular the syntax for the two "lines" that I've put an "*"
beside.
Every example I've seen in _Programming Perl_, _Programming the Perl
DBI_ and the _Cookbook_ tosses off the results of the
fetchall_arrayref() with a foreach loop.
Walter Lewis
Halton Hills