Skip to content

[bug]: unable to get recommendations #796

Closed

Description

@asgerjensen

Description

Using the RecommendClient and getting a result back, i get a list of records of inner-private class RecommendedHitWrapper

I do not see any way to convert this or get at the value, that is a RecommendHit.

Can someone clue me how i'm supposed to do this in v 4?

Client

Recommend

Version

4.22

Relevant log output

Class cast exception

Activity

  1. millotp commented on Sep 5, 2025

    @millotp
    Contributor

    Hey @asgerjensen,

    you can use getValue() defined just below:

  2. asgerjensen commented on Sep 5, 2025

    @asgerjensen
    Author

    Yees, but thats an inner class. The type returned is a RecommendationsHit.

    Even if i then rely on the inner class, it doesn't really read that nice.

    for(RecommendationsHit hit: result.getHits()) {
        RecommendHit actualHit = ((RecommendedHitWrapper)hit).getValue();
        String objectID = actualHit.getObjectID();
    }
    

    Is this the expected use?

    Seems i should be able to skip the wrapper somehow.. @millotp

  3. millotp commented on Oct 8, 2025

    @millotp
    Contributor

    Would it help to have helper methods like hit.asRecommendHit() or hit.asTrendingFacetHit() for example ?

  4. reopened this on Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions