1 Reply Latest reply on Jan 4, 2013 8:36 AM by WolfShade

    CF9 - multiple Solr collections search, remove dupes

    WolfShade Level 4

      Hello, everyone.

       

      I'm trying to search more than one Solr collection for a keyword (let's say "Item A"), but I want to remove any duplicates and keep the ranking.

       

      Hypothetically, let's say each collection has "Item A" in it, each ranked slightly different in their respective collection (99.9, 92.7, and 89.5).  How would I remove the two lower ranked "Item A"'s from the CFSEARCH?

       

      Thank you,

       

      ^_^

        • 1. Re: CF9 - multiple Solr collections search, remove dupes
          WolfShade Level 4

          I think I've got it.

           

          For anyone else who has this same need, try QoQ.

           

          <cfsearch name="cfSolrSearch" collection="collectionOne,collectionTwo,collectionThree" criteria="Item A">

          <cfquery name="removeDupes" dbtype="query">

            SELECT DISTINCT title, cast(score as decimal) as score

            FROM cfSolrSearch

            ORDER BY score DESC

          </cfquery>

          <cfdump var="#removeDupes#">

           

          ^_^

           

          PS.  In the first post, I mentioned "rank"; I meant "score".