Reputation: 215
I have Four files[One .PDF, one .doc and Two .docx]. I have created one ColdFusion collections named "testCollection" using ColdFusion Administrator. In Manage ColdFusion Collection screen i entered File Extensions [.pdf, .doc, .docx] and the directory path where the all 4 files are placed. Also checked the checkbox [Recursively Index Sub Directories]. Once i click submit i can see 5 documents with their size in Solr Collections.
After that i wrote below one cfm file to search file on the basis of their content.
Search.cfm
<cfcollection action="list" name="AllSolrCollections" engine="solr">
<!--- Filter to the collection that this application uses. --->
<cfquery name="chkSolrCollection" dbtype="query">
select * from AllSolrCollections
where AllSolrCollections.name = 'testCollection'
</cfquery>
<cftry>
<cfif chkSolrCollection.recordcount EQ 1>
<cfsearch name="mySearch" collection="testcollection" criteria="Aged" startrow=1>
</cfif>
<cfcatch type="SearchEngine">
<cfoutput>Error</cfoutput>
</cfcatch>
</cftry>
<cfdump var="#mySearch#">
When i entered criteria "Aged" it is giving me the correct result and showing all files except one file "Search_Not_Show_For_Aged.docx" since it has no search criteria content "Aged".
My issue is When i entered criteria "smoking", it is not giving me the correct result. it shows all files except one file "Search_Not_Show_For_Smoking.docx" but this files contains "smoking" word. I put my files in dropbox and share here
Please suggest and help to solve this issue.
Thanks
Upvotes: 2
Views: 205
Reputation: 215
If we do optimize the collection, the searching will work. We can Optimize Collection using coldfusion administration or using coldfusion code.
To Optimize collection using coldfusion administration:
Upvotes: 0