Skip to main content
WolfShade
Legend
January 4, 2013
Question

CF9 - multiple Solr collections search, remove dupes

  • January 4, 2013
  • 1 reply
  • 431 views

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,

^_^

    This topic has been closed for replies.

    1 reply

    WolfShade
    WolfShadeAuthor
    Legend
    January 4, 2013

    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".