Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
nTesla #1
Dynamic Collections
Hi, I manage four different websites with different requirements, but all of
them have the same requirements for the basic Verity search collection. I want
to create, index, optimize, repair, and delete the collection for each site
based on CGI parameters. I think you'll see what I mean if you look at the
attached code, which doesn't seem to work. (I do not have direct access to the
Coldfusion Administrator interface.) If you can suggest a way I can use the
same code, but fill in the variables dynamically, I would greatly appreciate
it.
<!--- This code is from a file called search_tools.cfm
tCollection is predefined in Application.cfm, but it's usually the same as
CGI.HTTP_HOST.
absPath is also predefined; it's something like
"D:\Inetpub\wwwroot\this_website".
verityPath is also predefined; it's terribly long, but you get the idea. --->
<cfif isDefined("form.FieldNames")>
<cfoutput>
<cfswitch expression="#form.CollectionAction#">
<cfcase value="Index">
<cfset tURL = "http://" & CGI.HTTP_HOST>
<cfindex
action="refresh"
collection="#tCollection#"
extensions=".cfm, .xls, .pdf, .doc, .ppt, .pot"
key="#absPath#"
urlpath="#tURL#"
recurse="yes"
language="en"
type="path">
<p>The collection "#tCollection#" has been indexed.</p>
</cfcase>
<cfcase value="Create">
<cflock timeout="60" name="createLock" type="exclusive">
<cfcollection
action="Create"
collection="#tCollection#"
path="#verityPath#"
language="en">
</cflock>
<p>
The collection "#tCollection#" has been created.
</p>
</cfcase>
<cfcase value="Repair">
<cflock timeout="60" name="repairLock" type="exclusive">
<cfcollection action="repair" collection="#tCollection#">
</cflock>
<p>
The collection "#tCollection#" has been repaired.
</p>
</cfcase>
<cfcase value="Optimize">
<cflock timeout="60" name="optimizeLock" type="exclusive">
<cfcollection action="optimize" collection="#tCollection#">
</cflock>
<p>
The collection "#tCollection#" has been optimized.
</p>
</cfcase>
<cfcase value="Delete">
<cflock timeout="60" name="deleteLock" type="exclusive">
<cfcollection action="delete" collection="#tCollection#">
</cflock>
<p>
The collection "#tCollection#" has been deleted.
</p>
</cfcase>
</cfswitch>
</cfoutput>
</cfif>
<!--- The action refers to this file --->
<form id="form" action="search_tools.cfm" method="post">
<fieldset class="natural">
<div class="legend">What do you want to do with the collection?</div>
<label>
<input type="radio" name="CollectionAction" value="Create" class="radio" />
Create </label>
<label>
<input type="radio" name="CollectionAction" value="Index" class="radio"
checked="checked" />
Index </label>
<label>
<input type="radio" name="CollectionAction" value="Repair" class="radio" />
Repair </label>
<label>
<input type="radio" name="CollectionAction" value="Optimize" class="radio" />
Optimize </label>
<label>
<input type="radio" name="CollectionAction" value="Delete" class="radio" />
Delete
</label>
</fieldset>
<fieldset class="submission" style="margin-top: 2em; ">
<div style="float:left">
<input type="submit" value="Submit" class="button" />
</div>
<div style="float:right">
<input type="reset" value="Reset" class="button" />
</div>
</fieldset>
</form>
nTesla Guest
-
Verity Collections
COLDFUSIONMX HELP PAGE SAYS: The Verity Development Kit (VDK) provides indexing and searching technology to create, populate, and manage... -
Collections as properties?
Hi, I'm creating my own custom web-control called Table, with a collection of my own custom 'Column's as a property: public class Table :... -
PHP Collections
Can anyone tell me what is the equivalent of a Java HashSet collection in PHP? Thanks, Andrew -
Collections
How Do I change the order and name of the columns in a datagrid that has been bound to a collection object ? -
InnerProperty Persistance for Collections containing other Collections
Hi All, Interesting problem. SETUP: Class A { string _name; BCollection _b; -
-
MikerRoo #3
Re: Dynamic Collections
You didn't provide details. What exactly is/are the failure symptom(s)? I have
used code similar to ths with no problems. Two observations: (A) The
extensions parameter has spaces in it. {extensions='.cfm, .xls, .pdf, .doc,
..ppt, .pot'} (I know the docs example does too.) You might try removing the
spaces as this is more likely to be a csv than a cssv. (B) Although probably
not the cause of failure, the switch statement has no default. Adding one
will save some grief now or in the future.
MikerRoo Guest
-
nTesla #4
Re: Dynamic Collections
Originally posted by: MikerRoo You didn't provide details. What exactly is/are
the failure symptom(s)? Well, I didn't want to confuse the issue, but you're
right, I should have posted some more details. The error message is fairly
confusing: ########## An error occurred while performing an operation in the
Search Engine native library. coldfusion.tagext.lang.CFCollectionTagException:
Error # -2 Error E0-1230 (Language): Could not create locale .. The error
occurred in D:\Inetpub\Wwwroot\chemwebs\application\search_too ls.cfm: line 68
66 : <cfcollection 67 : action='Create' 68 :
collection='#tCollection#' 69 : path='#verityPath#' 70 :
language='en'> ########## As far as I can tell, line 68,
'collection='#tCollection#',' has nothing to do with locales. Nevertheless,
it's highlighted. What's up with that?
nTesla Guest
-
-
Tom Jordahl #6
Re: Dynamic Collections
language="en" is the problem.
See the cfcollection documentation for valid languages, but you can use
"english" or "englishx" for English. Englishx is the "advanced" locale,
which indexes slightly slower but gives better search results.
Posting this error at the start would have probably gotten you a response
right away.
--
Tom Jordahl
Macromedia Server Development
Tom Jordahl Guest



Reply With Quote

