Copy link to clipboard
Copied
I am having problems getting the Search collection I created to display the PDF files. When I perform a search I am able to get the pdf file listing put when I select a PDF file to display it it does nothing. Please help, below is the Search Action page I did
<head>
<title>Search Results</title>
</head>
<body>
<cfsearch
name= "newspaperarchive_results"
collection= "newspaperarchive"
criteria= "#Form.Criteria#">
ContextHighlightBegin="<b>"
ContextHighlightEnd="</b>"
ContextPassages="1"
ContextBytes="500"
maxrows= "100">
<h2>Search Results</h2>
<cfoutput>
Your search returned #newspaperarchive_results.RecordCount# file(s).
</cfoutput>
<cfoutput query="newspaperarchive_results">
<p>
File: <a href="#url#">#key#</a><br>
Document Title (if any): #Title#<br>
Summary: #Summary#<b>
Highlighted Summary: #context#</p>
</cfoutput>
</body>
</html>
Copy link to clipboard
Copied
Let’s start by you giving us an example of the URL value shown in the hyperlink you build. Maybe that will help explain why visiting it returns a blank page.
/charlie
Copy link to clipboard
Copied
The ex. is below, but when I click on the link nothing happens Search
ResultsYour search returned 20 file(s).
File:
C:\inetpub\wwwroot\cfdocs\Newspaperfiles\Madison_County_Record\2013\05\18\Madison_County_Record_20130518.pdf<file:///C:/inetpub/wwwroot/cfdocs/Newspaperfiles/Madison_County_Record/2013/05/18/Madison_County_Record_20130518.pdf>
Document Title (if any): Madison County Record (May 18, 2013)
Score: 0.9018
summary: SATURDAY May 18, 2013 MADISON COUNTY MadisonCountyRecord.comRECORD
PUBLISHED EACH SATURDAY MADISON'S HOMETOWN NEWSPAPER SINCE 1967 25 CENTS
CLASSIFIEDS ONLINE POLL INSIDE Do you know a Madison resident graduating in
the next coming weeks? 20071207000856390 and other lands Section 19,
Township 3 South, Range 1 West, Huntsville Madison County, Alabama as same
is recorded in the office of the Judge of Probate of Madison County,
Alabama, in Document No.
On Thu, Mar 27, 2014 at 6:30 PM, Charlie Arehart
Copy link to clipboard
Copied
Ah, ok. Your problem is the link you are showing to the user (file:///C:/inetpub/wwwroot/cfdocs/Newspaperfiles/Madison_County_Record/2013/05/18/Madison_County_Record_20130518.pdf).
That will not likely work in a browser. Not saying it can’t work, or will never work. But it’s not likely what you really should be using. Let me explain.
Look closely at it: a) it asks for a file:/// directive. Note that traditional browser URLs use http://. Now, it’s not that file:// is wrong. It’s that it’s not appropriate here. It would only work if the path pointed to existed on the user’s machinee. Do they have a folder called c:/inetpub/wwwroot? No. That’s on YOUR server. (And even if this was an intranet application, they would not see that file in that location, as it’s on the server. You’re not offering a path that would work from even other machines on the same network.)
I suspect what you need is to convert this URL into a “web accessible one”, and the good news (well, good and bad) is that the file you are naming is in fact in a web accessible directory, your inetpub\wwwroot. Assuming you can serve a test.cfm page from c:\inetpub\wwwroot using http://yourdomain/test.cfm, then you can serve these files as http://yourdomain/cfdocs/Newspaperfiles/Madison_County_Record/2013/05/18/Madison_County_Record_20130....
Try that URL in your browser. If it works, then you just need to modify your code to provide THAT url to the user. To do that, you’d need to do some manipulation of the variable (you’re not showing us) which displays that link. If you’d share the line of code that outputs that link, we can provide code that will work. (Since you may be combining variables or functions to get the location you show now, I don’t want to just guess what might work.)
Hope that helps.
BTW, I said above that there was good news/bad news about this PDF being in a web accessible directory. It’s good for your need to just offer a link easily. It’s bad that if this is content that you may think you want to control in some way, such as to only show “some files” to “some people”, beware that anyone who sees one of these links (when we get it working) will be able to guess at other PDF file names. Just beware. (If you need to solve that, there are still other solutions, but they are way beyond the scope of this Solr forum.)
Indeed, as may be clear by now, your issue here (the problem you raised) isn’t really a Solr question at all. It’s more about fairly basic web and CF programming. Now, I don’t say that to embarrass you. Hey, we’ve all had a challenge like this some time in our coding lives. It’s just part of getting started with any particular challenge. My point though is that in asking for help here, in the Solr forum, you have limited your audience of help. Note that you’ve not gotten much (nor rapid) response. There are basic CFML forums and indeed several subforums for various aspects of working with CF. Just saying you may want to consider raising future questions there, if they really are of ongoing questions about basic application development. Hope that’s helpful.
/charlie
Copy link to clipboard
Copied
I'm still not understanding below is my search code. Http://127.0.0.1
html>
On Fri, Mar 28, 2014 at 12:00 PM, Charlie Arehart
Copy link to clipboard
Copied
@Masterp, if you’ll view your response on the forums, you’ll see that unfortunately none of the code you posted was rendered (http://forums.adobe.com/message/6278444#6278444). Did you perhaps respond to the discussion via email? If so, I wonder if you were to go to the forum directly, and either editor your note or create a new one, and paste your code in there, maybe the web-based editor would turn your code into something that could be rendered properly for display.
/charlie