Coldfusion Verity Collection, cannot retrieve multiple contexts from a single document?

80 Views Asked by At

Bipartite question - I have a form that takes one input-text box called 'criteria' and here is my action page:

<input type="button" onclick="self.location='form.cfm'" value="New Search">
&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">Search results for: 
<cfoutput><b>"#trim(form.criteria)#"</b></cfoutput></font>
<br><br>

<cfsearch collection="coll_x" name="cfr" type="simple" criteria="#trim(form.criteria)#"
maxrows="100" contextpassages="25" contexthighlightbegin="
<b style='background-color:FFFF00;'>" contexthighlightend="</b>">

<cfoutput>
<center>
<font color="green">#cfr.recordcount# Hits.</font>
<br>
<font color="red">#cfr.summary#</font>
<br><br><br>

<cfloop query="cfr">

<cfdump var="#valuelist(cfr.key)#">
<font color="blue">#cfr.context#</font>
<br><br><br>
</cfloop>
</center>
</cfoutput>

I can't seem to get more than one row out of this when I do a <cfdump>. If my understanding of the <cfsearch> tag is correct, it should highlight multiple results for the one document I have (.pdf) in my collection if I put a word that shows up multiple times in the doc in the form. Yet I consistently get just a single result, the first occurrence of the search string. Beyond getting the first 100 occurrences w/ a short synopsis (like I'm getting on the first one) - the second part of the question - I would also like to generate an <a href> for each result that links to a CF-generated copy of the pdf and lands the user on the page where that result was found but I see nothing that facilitates this in the documentation, e.g.: <a href=myformPDF.cfm?##trim(cfr.pagenumber)#> or something like that. Any ideas? I could also put the PDF in toto at the bottom of the search results and keep it on the same page if that makes it easier, though I'd prefer to use a separate page if at all possible. Thank you, SO.

PS: CF vers. 8

Edit: I have also tried the UDF outlined here - http://www.raymondcamden.com/2007/7/25/Reading-text-from-a-PDF-in-ColdFusion-8 to no avail. I get an "invalid XML character" error, presumably from the subsection (§) characters. Unfortunately replace() doesn't work to change these and I'm not sure how to access the XML and change it manually but if I understand correctly, this UDF only makes a temporary XML version which is discarded when the user navigates away, so it makes it a moot point as far as I can tell.

0

There are 0 best solutions below