Status/Resolution/Reason: Closed/Withdrawn/
Reporter/Name(from Bugbase): Robert Munn / Robert Munn (CFMunster)
Created: 05/09/2012
Components: Text Search
Versions: 9.0.1
Failure Type: Incorrect w/Workaround
Found In Build/Fixed In Build: 9.0.1 /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Windows 7
Vote Count: 0
Problem Description: The Solr server does not properly delete keys for file-based index entries using cfindex action=;delete.
Steps to Reproduce:
1.Create a Solr collection.
<cfparam name='collection' default='mycollection'/>
<cfparam name='collectionPath' default='c:\ColdFusion9\solr\multicore'/>
<cfcollection action='create' collection='#collection#' engine='solr' path='#collectionPath#'/>
2. Populate the collection with some documents on the server using cfindex action=update type=path or type=file. I used this PDF for the test:
http://www.flex-tutorial.fr/wp-content/uploads/2009/01/data-push-in-flex-using-blaze-ds.pdf
<cfparam name='collection' default='mycollection'/>
<cfparam name='filename' default='c:\docs\data-push-in-flex-using-blaze-ds.pdf'/>
<cfparam name='folderAlias' default='\docs'/>
<cfindex action='update' collection='#collection#' type='file' key='#filename#' urlpath='#folderAlias#' />
3. Check the Solr collection to verify that the documents are present. You can check using cfsearch or by going to the Solr admin directly at <server>:<port>/solr/<collection>/admin and looking at the Statistics link for the number of documents in the collection.
http://localhost:8983/solr/mycollection/admin/
4. Use cfindex action=delete key=<filename> to delete the entry from the index.
<cfparam name='collection' default='mycollection'/>
<cfparam name='filename' default='c:\docs\data-push-in-flex-using-blaze-ds.pdf'/>
<!--- this code fails to delete the key --->
<!---
<cfindex action='delete' collection='#collection#' key='#filename#' status='c' />
<cfdump var='#c#'/>--->
5. Check the Solr collection again for the number of documents.
Actual Result:
The document is not removed from the index, and the number of documents in the Solr Statistics remains the same.
Expected Result:
The document should be deleted and the number of documents in the Solr Statistics should be reduced by one.
Any Workarounds:
1. Change schema.xml for the collection - make indexed='true' for the key field (line 444 in CF9.01). Restart Solr.
2. Use the SolColdFusion component found on RIAForge to search for the index entry by key, then delete the entry from the index by id.
http://solcoldfusion.riaforge.org/
Example code to delete the key entry using theSolColdFusion component:
<cfparam name='collection' default='mycollection'/>
<cfparam name='filename' default='c:\docs\data-push-in-flex-using-blaze-ds.pdf'/>
<cfset solr = createObject("component", "org.apache.solr.client.SolColdfusion").init("http://localhost", "8983", "/solr/#collection#") />
<cfset params = arrayNew(1) />
<cfset params[1][1] = "fl" />
<cfset params[1][2] = "uid" />
<!--- filename should be fully qualified path to file --->
<cfset result = xmlparse(solr.search('key:#solrformat(filename)#',0,1,params))/>
<cfset uid = xmlsearch(result,"/response/result//doc[1]/str[@name='uid']")[1].XmlText/>
<cfset solr.deleteById(id=uid)/>
<cfset solr.commit()/>
<cffunction name='solrFormat' access='private' returntype='string'>
<cfargument name="str" type='string' required='true' />
<cfset local.mystr = arguments.str />
<cfset local.charList = '\,+,-,&&,||,!,(,),{,},[,],^,",~,*,?,:'/>
<cfloop list='#local.charList#' index='c'>
<cfset local.mystr = replace(local.mystr,c,'\' & c,'all')/>
</cfloop>
<cfreturn local.mystr />
</cffunction>
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3186302
External Customer Info:
External Company:
External Customer Name: CFMunster
External Customer Email:
External Test Config: HP Envy, Core-I7 quad core
16 GB RAM
Windows 7 SP1 64 bit
CF 9.01 HF 2
Attachments:
Comments: