Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Index Search...

Index Search...

Scheduled Pinned Locked Moved ASP.NET
databasejavascriptcsshelp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Moghan
    wrote on last edited by
    #1

    Can we use the SUBSTRING in Index Search select Query... ie Something like the below.. cmdSearch.CommandText = "select Vpath, path, FileName, size, write, attrib, SUBSTRING(Characterization,90,DATALENGTH(Characterization)-1) as Characterization, DocTitle, rank from scope('shallow traversal of " + "\"" + "/Software" + "\"" + "," + "\"" + "/Industries" + "\"" + "," + "\"" + "/" + "\"" + "') where FREETEXT(contents,'" + searchText + "') and FileName NOT LIKE 'inc_%' and FileName NOT LIKE '%.js' and FileName NOT LIKE 'searchresult.aspx' and FileName NOT LIKE '%.css' order by rank desc "; Im getting Error: Incorrect syntax near '('. Expected ',', '.', FROM. SQLSTATE=42000

    A H 2 Replies Last reply
    0
    • M Moghan

      Can we use the SUBSTRING in Index Search select Query... ie Something like the below.. cmdSearch.CommandText = "select Vpath, path, FileName, size, write, attrib, SUBSTRING(Characterization,90,DATALENGTH(Characterization)-1) as Characterization, DocTitle, rank from scope('shallow traversal of " + "\"" + "/Software" + "\"" + "," + "\"" + "/Industries" + "\"" + "," + "\"" + "/" + "\"" + "') where FREETEXT(contents,'" + searchText + "') and FileName NOT LIKE 'inc_%' and FileName NOT LIKE '%.js' and FileName NOT LIKE 'searchresult.aspx' and FileName NOT LIKE '%.css' order by rank desc "; Im getting Error: Incorrect syntax near '('. Expected ',', '.', FROM. SQLSTATE=42000

      A Offline
      A Offline
      AlexeiXX3
      wrote on last edited by
      #2

      Have you tried removing the substring part and seeing what happens?? Anyways... whats this stuff for??

      from scope('shallow traversal of " + "\"" + "/Software" + "\"" + "," + "\"" + "/Industries" + "\"" + "," + "\"" + "/" + "\"" + "')

      Alexei Rodriguez

      H M 2 Replies Last reply
      0
      • M Moghan

        Can we use the SUBSTRING in Index Search select Query... ie Something like the below.. cmdSearch.CommandText = "select Vpath, path, FileName, size, write, attrib, SUBSTRING(Characterization,90,DATALENGTH(Characterization)-1) as Characterization, DocTitle, rank from scope('shallow traversal of " + "\"" + "/Software" + "\"" + "," + "\"" + "/Industries" + "\"" + "," + "\"" + "/" + "\"" + "') where FREETEXT(contents,'" + searchText + "') and FileName NOT LIKE 'inc_%' and FileName NOT LIKE '%.js' and FileName NOT LIKE 'searchresult.aspx' and FileName NOT LIKE '%.css' order by rank desc "; Im getting Error: Incorrect syntax near '('. Expected ',', '.', FROM. SQLSTATE=42000

        H Offline
        H Offline
        Harini N K
        wrote on last edited by
        #3

        Hi I think there is no error in the SubString function, there is an error after scope function. For searching multiple folders, syntax is given below: SELECT "DAV:displayname" FROM SCOPE('shallow traversal of "http://myserver/public"', 'shallow traversal of "http://myserver/public/userinfo"', 'shallow traversal of "http://myserver/public/userinfo/phonenumber"') Please check this site for more information: http://msdn2.microsoft.com/en-us/library/aa579385(EXCHG.80).aspx[^] When i debug your code, i got the following statement: select Vpath, path, FileName, size, write, attrib, SUBSTRING(Characterization,90,DATALENGTH(Characterization)-1) as Characterization, DocTitle, rank from scope('shallow traversal of \"/Software\",\"/Industries\",\"/\"') where FREETEXT(contents,'abc') and FileName NOT LIKE 'inc_%' and FileName NOT LIKE '%.js' and FileName NOT LIKE 'searchresult.aspx' and FileName NOT LIKE '%.css' order by rank desc which is different from the given syntax. Hope this helps.

        Harini

        M 1 Reply Last reply
        0
        • A AlexeiXX3

          Have you tried removing the substring part and seeing what happens?? Anyways... whats this stuff for??

          from scope('shallow traversal of " + "\"" + "/Software" + "\"" + "," + "\"" + "/Industries" + "\"" + "," + "\"" + "/" + "\"" + "')

          Alexei Rodriguez

          H Offline
          H Offline
          Harini N K
          wrote on last edited by
          #4

          Click this link: http://msdn2.microsoft.com/en-us/library/aa579385(EXCHG.80).aspx[^]

          Harini

          1 Reply Last reply
          0
          • A AlexeiXX3

            Have you tried removing the substring part and seeing what happens?? Anyways... whats this stuff for??

            from scope('shallow traversal of " + "\"" + "/Software" + "\"" + "," + "\"" + "/Industries" + "\"" + "," + "\"" + "/" + "\"" + "')

            Alexei Rodriguez

            M Offline
            M Offline
            Moghan
            wrote on last edited by
            #5

            Ya If im removing the SUBSTRING the Query works fine. The SCOPE() function is used to search the SEARCH STRING with my ROOT folder,Industries and Software folders only. No SubFolders are included while Searching.

            1 Reply Last reply
            0
            • H Harini N K

              Hi I think there is no error in the SubString function, there is an error after scope function. For searching multiple folders, syntax is given below: SELECT "DAV:displayname" FROM SCOPE('shallow traversal of "http://myserver/public"', 'shallow traversal of "http://myserver/public/userinfo"', 'shallow traversal of "http://myserver/public/userinfo/phonenumber"') Please check this site for more information: http://msdn2.microsoft.com/en-us/library/aa579385(EXCHG.80).aspx[^] When i debug your code, i got the following statement: select Vpath, path, FileName, size, write, attrib, SUBSTRING(Characterization,90,DATALENGTH(Characterization)-1) as Characterization, DocTitle, rank from scope('shallow traversal of \"/Software\",\"/Industries\",\"/\"') where FREETEXT(contents,'abc') and FileName NOT LIKE 'inc_%' and FileName NOT LIKE '%.js' and FileName NOT LIKE 'searchresult.aspx' and FileName NOT LIKE '%.css' order by rank desc which is different from the given syntax. Hope this helps.

              Harini

              M Offline
              M Offline
              Moghan
              wrote on last edited by
              #6

              Hi Harini, That SCOPE() function is working fine. Based on ur reply on yesterday only i solved that problem.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups