I have a Solr collection for literature which I store both a reference to the
original file in a database and the physical file on the filesystem. When a new
piece of literature is added to the system, I update the Solr collection with
the following code:
<cfoutput query="literatureQuery">
<cfset litFile = litpath & "#literatureID#.pdf" />
<cfif fileExists(litFile)>
<cfindex
action="update"
collection="literature_solr"
type="file"
key="#litFile#"
title="#documentName#"
body="litNumber,documentName"
custom1="/literature/#alias#"
custom2="#litNumber#"
custom3="#documentName#">
</cfif>
<cfquery name="tableCleanup" datasource="#dsn#">
UPDATE literature
SET indexed = <cfqueryparam cfsqltype="cf_sql_bit" value="1" />
WHERE literatureID = <cfqueryparam cfsqltype="cf_sql_char"
value="#literatureID#" />
</cfquery>
</cfoutput>
This works fine and I am able to search for the file using cfsearch. However, I
have a problem with deleting keys from the catalog when a file is deleted. For
that I use the following code:
<cfoutput query="deletedLiterature">
<cfset litFile = litpath & "#literatureID#.pdf" />
<!--- Delete the deleted literature from the literature collection. --->
<cfindex
collection="literature_solr"
type="file"
action="Delete"
key="#litFile#">
</cfoutput>
<!--- Remove temporary entries --->
<cfquery name="tableCleanup" datasource="#dsn#">
DELETE
FROM literatureToDelete
</cfquery>
The problem that I have is that the key is not being deleted from collection
and is still showing up in searches. The only way that I have been able to
clear it out is to purge the whole catalog and re-index all the documents. Has
anyone else had this problem?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348373
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm