Hi all,
I am trying to get a remote solr instance working with oak. Because of lack of
good documentation, I tried find out the proper configuration myself, however,
if I commit new nodes they are not send to the Solr server for indexing. Also
no queries seem to be forwarded to the Solar instance. I use the attached code
to initialize the repository and use jackrabbit ocm to persist nodes.
Debugging shows that SolrIndexEditorProvider gets invoced after a
session.save(), but it seems to look for "SolrQueryIndex.TYPE.equals(type)". I
don't get what this type is used for and how set up it in the right way.
For the first try I just want all properties of my node indexed by Solr. Has
someone additional resources, code or hints what I have to do?
Thanks in advance for your help
Best Leonhard Wachutka
protected Repository createRepository() throws Exception {
RemoteSolrServerConfiguration remoteSolrConfig = new
RemoteSolrServerConfiguration(null, null, 1, 1, null,
"http://192.168.2.250:8983/solr/oak");
SolrServerProvider solrServerProvider = new
RemoteSolrServerProvider(remoteSolrConfig);
OakSolrConfiguration oakSolrconfiguration = new
DefaultSolrConfiguration() {
@Override
public CommitPolicy getCommitPolicy() {
return CommitPolicy.HARD;
}
@Override
public boolean useForPropertyRestrictions() {
return true;
}
@Override
public boolean useForPrimaryTypes() {
return true;
}
@Override
public boolean useForPathRestrictions() {
return true;
}
};
OakSolrConfigurationProvider oakSolrConfigurationProvider = new
DefaultSolrConfigurationProvider(oakSolrconfiguration);
// return JackRabbit repository.
log.info("Start of Apache Jackrabbit OAK Repository.\n{host:" + host
+"\ndbName:"+ dbName+"}");
DB db = new MongoClient(host, 27017).getDB(dbName);
documentNodeStore = new DocumentMK.Builder().
setMongoDB(db).getNodeStore();
oak = new Oak(documentNodeStore)
.with(new SolrIndexInitializer(true))
.with(AggregateIndexProvider.wrap(new
SolrQueryIndexProvider(solrServerProvider, oakSolrConfigurationProvider)))
.with(new SolrIndexEditorProvider(solrServerProvider,
oakSolrConfigurationProvider));
Repository repo = new Jcr(oak).createRepository();
return repo;
}