2009/8/12 Fabrice Estiévenart <fabrice.estieven...@cetic.be> > Hello, > > I need to sort my hits according to a rate of "popularity" which > dynamically and periodically changes. Thus, I can't store this popularity in > the index and I have to get it, from memory, at query-time. > > Is it possible with Solr ? Thank you. >
Not out of the box. Something like this should be possible by creating your own ValueSource. Look at the ExternalFileField and FileFloatSource in Solr as an example. Instead of loading from a file, you can load it from some other source and refresh it periodically. You won't be able to sort on it using the sort parameter until [1] is complete. However, you can achieve a similar effect by boosting documents by a function of popularity using function queries in the "q" parameter. However, if you can re-index your documents periodically, just add the popularity value into the document itself and avoid a complicated system. We do this for a multi-million document index (storing daily popularity as a field). We also have another smaller index which we re-index every 15 minutes with the latest popularity values. [1] - https://issues.apache.org/jira/browse/SOLR-1297 -- Regards, Shalin Shekhar Mangar.