Apachesolr sort based on nodeviewcount
Take a look at Apache Solr View Count module which does exactly the same.


  This module allows you to index the node view count to Apache solr
  index as a custom field and let you sort SOLR results. The module
  requires Apache solr search module. 


Disclosure: I'm one of the module maintainer.