Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default 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 &quot;#tCollection#&quot; 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 &quot;#tCollection#&quot; has been created.
    </p>
    </cfcase>
    <cfcase value="Repair">
    <cflock timeout="60" name="repairLock" type="exclusive">
    <cfcollection action="repair" collection="#tCollection#">
    </cflock>
    <p>
    The collection &quot;#tCollection#&quot; has been repaired.
    </p>
    </cfcase>
    <cfcase value="Optimize">
    <cflock timeout="60" name="optimizeLock" type="exclusive">
    <cfcollection action="optimize" collection="#tCollection#">
    </cflock>
    <p>
    The collection &quot;#tCollection#&quot; has been optimized.
    </p>
    </cfcase>
    <cfcase value="Delete">
    <cflock timeout="60" name="deleteLock" type="exclusive">
    <cfcollection action="delete" collection="#tCollection#">
    </cflock>
    <p>
    The collection &quot;#tCollection#&quot; 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

  2. Similar Questions and Discussions

    1. Verity Collections
      COLDFUSIONMX HELP PAGE SAYS: The Verity Development Kit (VDK) provides indexing and searching technology to create, populate, and manage...
    2. 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 :...
    3. PHP Collections
      Can anyone tell me what is the equivalent of a Java HashSet collection in PHP? Thanks, Andrew
    4. Collections
      How Do I change the order and name of the columns in a datagrid that has been bound to a collection object ?
    5. InnerProperty Persistance for Collections containing other Collections
      Hi All, Interesting problem. SETUP: Class A { string _name; BCollection _b;
  3. #2

    Default Re: Dynamic Collections

    A day later, and still no replies: <bump>
    nTesla Guest

  4. #3

    Default 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

  5. #4

    Default 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

  6. #5

    Default Re: Dynamic Collections

    bump
    nTesla Guest

  7. #6

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139