I would like to use SOLR to do search on my android app. Is this something that I can do? If so could you please point me to some code samples out there? Thanks
问题:
回答1:
Depends. Solr is a quite heavy server application, it's not really suited to run on an Android device.
You'll want to run Solr on a server somewhere and have your Android app connect to Solr via HTTP.
However, Solr is not designed to be used as a public HTTP application (see the Solr security wiki page), so it's generally best to write a small web service that acts as a proxy and at the same time offers a simplified, tailored API for your Android app.
回答2:
In a particular Android application I know, they use an API endpoint written in a Python framework which talks JSON. They use both MySQL and Solr for persistence and some kinds of data is stored exclusively in Solr. And yes, they are using Solr for it's query capabilities.
Do follow a "Android client <-> API <-> persistence layer" design; dont expose
any databases directly to the android client. As Mauricio Scheffer pointed out,
Solr is not smart enough to secure itself from a delete *
from someone who
reverse-engineered your app; a properly designed API can handle illegal requests.
回答3:
performing a SOLR search on mobile device using this modified class for ANDROID
https://gist.github.com/soltrinox/4b1b85509699c718b5d9