Joey:

I'm not sure what you mean by wapping solr to your own web application.  There 
is a way to embed Solr into your application (same JVM), but I've never used 
that.  If you're talking about your servlet running in one JVM and Solr in 
another, then use the SolrJ client library to interact with Solr.  I use 
CommonsHttpSolrServer 
(http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.html)
 and specify the URL that locates the Solr server/core name.
I use Spring to instantiate the server instance, and then I inject it where I 
need it.

        <bean id="solrServerIngContent" 
class="org.apache.solr.client.solrj.impl.CommonsHttpSolrServer">
                <constructor-arg value="http://localhost:8091/solr/mycorename"/>
        </bean>

Thus is equivalent to new 
CommonsHttpSolrServer("http://localhost:8091/solr/mycorename";);

Check out the API link above and http://wiki.apache.org/solr/Solrj to examples 
on using the SolrJ API.

Cheers,

Jeff

On Dec 13, 2011, at 12:12 PM, Joey wrote:

> Hi I am new to Solr and want to do some customize development. 
> I have wrapped solr to my own web application, and want to write a servlet
> to index a file system. 
> 
> The question is how can I get SolrServer inside my Servlet?
> 
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/How-to-get-SolrServer-tp3583304p3583304.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to