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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to avoid same ranks while doing a FULLTEXT

How to avoid same ranks while doing a FULLTEXT

Scheduled Pinned Locked Moved Database
tutorial
5 Posts 2 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.
  • J Offline
    J Offline
    jophinmichael
    wrote on last edited by
    #1

    Hi guys, I am doing a FULLTEXT search as shown below Select t.*,k.[Rank] From table1 t Join Containstable(table1, column3, 'abcd|efgh|ijkl|mnop') As k On t.Id = k.[Key] Order By k.[Rank] DESC But I want the results to be ranked distinctly. Currently my results are listed something like the below column1 column2 column3 Rank 1 asdc abcd|efgh|ijkl|mnop 99 2 asdad abcd|efgh|ijkl 99 3 cdsdfc abcd 80 4 efsef abcd|efgh 30 5 asasda abcd|efgh|ijkl 30 6 dsas abcd|efgh|ijkl|mnop 30 Also please note that row1 and row6 are having same values for column3 but the ranks are 99 and 30 respectively. Thanks in Advance Jophin jophin

    S 1 Reply Last reply
    0
    • J jophinmichael

      Hi guys, I am doing a FULLTEXT search as shown below Select t.*,k.[Rank] From table1 t Join Containstable(table1, column3, 'abcd|efgh|ijkl|mnop') As k On t.Id = k.[Key] Order By k.[Rank] DESC But I want the results to be ranked distinctly. Currently my results are listed something like the below column1 column2 column3 Rank 1 asdc abcd|efgh|ijkl|mnop 99 2 asdad abcd|efgh|ijkl 99 3 cdsdfc abcd 80 4 efsef abcd|efgh 30 5 asasda abcd|efgh|ijkl 30 6 dsas abcd|efgh|ijkl|mnop 30 Also please note that row1 and row6 are having same values for column3 but the ranks are 99 and 30 respectively. Thanks in Advance Jophin jophin

      S Offline
      S Offline
      Scubapro
      wrote on last edited by
      #2

      I'm not quite sure what you want. If you want row 6 just below row 1 and so on, just add another order filter:

      Order By t.column3 [DESC/ASC], k.[Rank] DESC

      J 1 Reply Last reply
      0
      • S Scubapro

        I'm not quite sure what you want. If you want row 6 just below row 1 and so on, just add another order filter:

        Order By t.column3 [DESC/ASC], k.[Rank] DESC

        J Offline
        J Offline
        jophinmichael
        wrote on last edited by
        #3

        Hi Scubapro, Select t.*,k.[Rank] From table1 t Join Containstable(table1, column3, 'abcd|efgh|ijkl|mnop') As k On t.Id = k.[Key] Order By k.[Rank] DESC column1 column2 column3 Rank 1 asdc abcd|efgh|ijkl|mnop 99 2 asdad abcd|efgh|ijkl 99 3 cdsdfc abcd 80 4 efsef abcd|efgh 30 5 asasda abcd|efgh|ijkl 30 6 dsas abcd|efgh|ijkl|mnop 30 I am not able to do an order by for the column3 because its data type is ntext. My actual requirement is that row1 and row2 should not have equal ranks because,Row1 is an exact match and Row2 is not. It is fine for me if, Rank of Row2=Rank of Row5 and Rank of Row1=Rank of Row6 because they are having equal values for column3. Kind Regards jophin

        S 1 Reply Last reply
        0
        • J jophinmichael

          Hi Scubapro, Select t.*,k.[Rank] From table1 t Join Containstable(table1, column3, 'abcd|efgh|ijkl|mnop') As k On t.Id = k.[Key] Order By k.[Rank] DESC column1 column2 column3 Rank 1 asdc abcd|efgh|ijkl|mnop 99 2 asdad abcd|efgh|ijkl 99 3 cdsdfc abcd 80 4 efsef abcd|efgh 30 5 asasda abcd|efgh|ijkl 30 6 dsas abcd|efgh|ijkl|mnop 30 I am not able to do an order by for the column3 because its data type is ntext. My actual requirement is that row1 and row2 should not have equal ranks because,Row1 is an exact match and Row2 is not. It is fine for me if, Rank of Row2=Rank of Row5 and Rank of Row1=Rank of Row6 because they are having equal values for column3. Kind Regards jophin

          S Offline
          S Offline
          Scubapro
          wrote on last edited by
          #4

          Try:

          Join Containstable(table1, column3, '("abcd|efgh|ijkl|mnop")') As k On t.Id = k.[Key]

          J 1 Reply Last reply
          0
          • S Scubapro

            Try:

            Join Containstable(table1, column3, '("abcd|efgh|ijkl|mnop")') As k On t.Id = k.[Key]

            J Offline
            J Offline
            jophinmichael
            wrote on last edited by
            #5

            Hi Scubapro, Thanks for the reply. But this is not making any difference in the rankings. But we found that the current ranking is somehow ok for us. Thanks for you efforts Regards

            jophin

            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