• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using solr with java best practices

 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i wanted to know anbody has any experience of working with solrJ a Java client to hit solr data repository.
i went through some sample code and upon running it ruturns solar document which matches my search.
is there a way to convert those solr document into my javabean domain model.

If the response returned was raw xml we could use castor or apache xfire beans to map raw xml to java objects.
Wondering how can we do with mapping solrdocument with java objects rather than initializing them with hands

any advice.
Rashid
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am also looking for a similar solution. Is there any way how I can map my .xml file in eXist server and use Apache Solr to query data in that XML file. The user interface comes from a html document.
 
Darvesh Niz
Ranch Hand
Posts: 123
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow its beena while i asked this question, but we have solrj extensively after that.
Using SolrJ you can have annotation defined which is mapped to the schema file just like any other ORM mapping.
SolrJ annotation does all the dirty work of converting solr documents to your java beans

QueryResponse qr = server.query(query);
domainBean = qr.getBeans(domainBean.class)

where domain bean is something like
public class DomainBean{

@Field("id")
private String id = null;
@Field("c_title")
private String title = null;
@Field("c_description")
private String description = null;

Hope it helps
 
Pawankumar Jajara
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it helped a lot. Thanks for the information. The Google has very few web pages for Apache Solr which makes newbies life pretty hard.

Thanks,
Pawankumar Jajara
 
Darvesh Niz
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ONce place where i got a lot of help was
the nabble solr forums and the solr wiki

 
reply
    Bookmark Topic Watch Topic
  • New Topic