Hi Lance,

On Mon, May 10, 2010 at 5:43 PM, Lance Norskog <goks...@gmail.com> wrote:

>
> It thinks you are talking to a core named 'Universities'. If this does
> not help, you could post the code that opens the SolrServer and
> creates the query object.
>
>
 It's looking for a core named "Universities - Embedded Solr Server"
actually. I've tried to set this to just "" as described in the wiki page
but that didn't work either. I looked through the wiki page on the
solrconfig.xml and I don't see a way to define the core name?
http://wiki.apache.org/solr/SolrConfigXml

The code I'm using to create the embedded server is:
[code lang="groovy"]
String solrHome =
ConfigurationHolder.config.universitySearchService?.solrHome ?: ""
// set to:
/Users/eberry/development/applications/apache-solr-1.4.0/example/solr
if (!solrHome) {
   throw new IllegalArgumentException("UniversitySearchService configured as
embedded, but no solrHome property is set.")
}
// copied from: http://wiki.apache.org/solr/Solrj#EmbeddedSolrServer
System.setProperty("solr.solr.home", solrHome)
CoreContainer.Initializer initializer = new CoreContainer.Initializer()
CoreContainer coreContainer = initializer.initialize()
server = new EmbeddedSolrServer(coreContainer, "Universities - Embedded Solr
Server")
[/code]

The code where I create a query is:
[code lang="groovy"]
def search(Map options = [:], String query) {
   Map solrOptions = [query: query] + options
   SolrQuery solrQuery = new SolrQuery(solrOptions)
   QueryResponse response = server?.query(solrQuery)
   def universities = []
   response?.results?.each { document ->
      universities << new University(
            country: document.country,
            id: document.id,
            name: document.name,
            state: document.state
      )
   }
   return universities
}
[/code]

-- 
Learn from the past. Live in the present. Plan for the future.
Blog: http://www.townsfolkdesigns.com/blogs/elberry
jEdit <http://www.jedit.org> - Programmer's Text Editor
Bazaar <http://bazaar.canonical.com> - Version Control for Humans

Reply via email to