IMO you’re making this more complicated than it needs to be. Forget for a moment where the user profile is stored. Say user A likes turtles. User B likes puppies.
User A queries, and this gets sent to Solr: q=something&bq=turtles User B queries: q=something&bq=puppies I’d fetch the user preference details _before_ making the call to Solr, and augment the call to Solr with the user-specific boosting/parameters. If you happen to store the user preferences in a Solr document, fetch that document in your application tier before making the call to Solr (and I’d suggest using a separate collection for user preferences). Sure, that’s two Solr requests, but… no worries! Fetching a single document from Solr that is likely cached anyway won’t be slow. And if you account for implementation time in your effort, it’s a big win. :) For the record - this is the kind of thing we do in Lucidworks Fusion - sidecar collections, looking stuff up (preferences, recommendations, rules, etc etc) and augmenting the final/real Solr request. Sounds kinda simplistic, and it is. But the synergy of these simple things working together is Powerful Magic. I’d hate to see you go down a really complicated and custom route to achieve what you’re asking, but I do empathize with the sentiment to roll all this together into a single Solr request hiding all the magic. But simpler and straightforward is better than complex and custom if the end result is the same :) Erik > On Jan 5, 2018, at 6:10 AM, marco <marco.mutt...@gmail.com> wrote: > > Hi, first of all I want to say that i'm a beginner with the whole Lucene/Solr > environment. > I'm trying to create a simple personalized search engine, and to do so i was > thinking about adding a parameter user=xxxx to the uri of the query > requests, that i would need during the scoring phase to rerank the result on > based on the user profile (stored as a normal document). > > My question is: how can i create a custom Similarity class that is able to > retrieve a parameter passed during the request phase? I "know" from this > https://medium.com/@wkaichan/custom-query-parser-in-apache-solr-4634504bc5da > <https://medium.com/@wkaichan/custom-query-parser-in-apache-solr-4634504bc5da> > > that extending QParsePlugin I can access the request parameters, but how can > i pass them during the whole chain of search operations so that they are > accessible during the scoring phase? > > Thank you for your help. > > > > -- > Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html