3 Replies Latest reply on Jan 9, 2008 2:48 PM by corey_mcm

    Using Verity to search source code

      I'm writing a help application to keep track of the development of another (larger) coldfusion application. One of the components keeps tracks of variable declarations, and to do this I need to search the source code for instances of the variable name.
      I'm using verity but seem to be running into some problems. I've created the collection in administrator using filetypes with extensions .cfm, .cfml, .xml, .html, .htm and WITH subdirectory recursion. It lists approximately 300 files as being indexed, which should be about right.
      When I search the collection I'm not getting all the hits I should be. I think the problem is rooted in the fact I need to find substrings of the criteria, which verity doesn't seem to be doing. For example, for a variable someVar it has no problems finding:
      ...code... someVar ...code...

      but problems seem to arise when looking for things like
      # someVar#

      I've tried:
      <cfsearch collection="rsSourceCollection" name="qSource" criteria="#searchStr#" />
      <cfsearch collection="rsSourceCollection" name="qSource" type="explicit" criteria="<wildcard>*#searchStr#*" />
      <cfsearch collection="rsSourceCollection" name="qSource" type="explicit" criteria="<wildcard>*'#searchStr#'*" />

      ... to no avail.

      Any help would be greatly appreciated.

        • 2. Re: Using Verity to search source code
          Level 7
          Oops, sorry: I saw your post back when you made it and meant to have a
          think about it and come up with something, but clean forgot. I blame Xmas.

          Have you read the docs for how to build Verity search strings?

          Of your three options, I would have expected the middle one to work.

          Have you tried just using the internet search type?

          Bear in mind, too, that Verity is case-sensitive, if your criteria is
          mixed-case. For CF variables which are not cse-sensitive, I'd not be doing
          case-sensitive searches.

          • 3. Re: Using Verity to search source code
            corey_mcm Level 1
            No problems, thanks for the reply.

            I've read over that document to no avail, either I'm doing something wrong or there is something wrong with Verity.

            I'm using:

            <cfset searchStr = LCase(#qQuery.vars_name#) />
            <cfsearch collection="rsSourceCollection" name="qSource" type="internet" criteria="#searchStr#" />

            ... at the moment, but still am not receiving all results. I know this is the case because a full text search of the project within Eclipse returns A LOT more files containing the variable name. Will internet search look for substrings by default?

            One of my biggest problems is when I'm searching for a variable with a period in it, such as 'fusebox.fuseaction'. From my research I've established that verity doesn't like searching on criteria containing fullstops and I need to create a style.lex file to create a mapping between the period character and the entity version of the character, but I can't find any resources to state how the style.lex file should be formatted.