Skip to main content
Level 4
Oct 16, 2015 2:27 AM UTC
Solved

maven dependency issue for FTS

I want to implement Free Text search using remote Solr server with AEM 6.

I have done the configurations as advised here.

Now I want to demonstrate search using this remote solr server.I have created  a search component for this.I have attached the code, pls let me know if this is correct way of connecting to remote solr server.

i am including 

 <dependency>
            <groupId>org.apache.solr</groupId>
            <artifactId>solr-core</artifactId>
            <version>4.3.0</version>
            <scope>compile</scope>
        </dependency> 

in my main parent pom(main pom of maven multimodule project) and 

 <dependency>
            <groupId>org.apache.solr</groupId>
            <artifactId>solr-core</artifactId>
  </dependency> 

and 

 <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>searchApp-bundle</Bundle-SymbolicName>
                             <Embed-Transitive>true</Embed-Transitive>
                             <Embed-Dependency>*;scope=runtime|compile</Embed-Dependency>
                 </instructions>
                </configuration>
            </plugin>

The project compiles fine locally but when I upload it as an osgi bundle the transitive dependencies cause a lot of unresolved dependencies.I wonder I why the transitive dependencies are not icluded in the resulting bundle even after specifying   <Embed-Transitive>true</Embed-Transitive>.

Any help or sample code snippet will  help a lot.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
gopalKaAccepted solution
Adobe Employee
Oct 16, 2015 2:27 AM UTC

AEM already integrates with solr. Please have a look at http://docs.adobe.com/docs/en/aem/6-0/deploy/upgrade/queries-and-indexing.html . So solrj is already present as a bundle in AEM. In any case, i suggest you leverage the OOB integration. The OOB integration also respects the ACLs when it fetches from the indexes. You have to handle that if you query directly.

7 replies

asn11Author
Level 4
Oct 16, 2015 2:27 AM UTC

Thanks , I have tried searching the SolrJ dependency on depFinder but could not find it.Let me know if theres another way of doing it.

Translate
Adobe Employee
Oct 16, 2015 2:27 AM UTC

Hi,  Typically , you need to identify all the packages that you need and export them. Identify all the dependent bundles and embed them in one big bundle. Please use an already existing osgi solr bundle like http://mvnrepository.com/artifact/org.apache.servicemix.bundles/org.apache.servicemix.bundles.solr-solrj or many of our partners have done this integration. You can use http://www.aemsolrsearch.com/#/ . Adobe doesnt not support this. You can learn from the code and bundle posted there or just use it.

Translate
asn11Author
Level 4
Oct 16, 2015 2:27 AM UTC

<dependency>
            <groupId>org.apache.solr</groupId>
            <artifactId>solr-core</artifactId>
            <version>4.3.0</version>
            <scope>provided</scope>
        </dependency> 

 

Tried providing scope as Provided as well, when I upload this bundle I get errors for below mentioned dependencies(which are transitive)

solr-solrj, lucene-core, lucene-codecs etc...

I even tried including these three dependencies ...only to encounter more resolution errors...

Translate
asn11Author
Level 4
Oct 16, 2015 2:27 AM UTC

Thanks, But I have followed the instructions provided in the link you referred to.

I want to connect to the remote solr through code.In that case I should be able to upload the OSGi bundle, which I m not able to.

Thanks in advance.

Translate
Feike_Visser1
Adobe Employee
Adobe Employee
Oct 16, 2015 2:27 AM UTC

You can also use the dependency finder to know exactly the dependency you need to add:

/system/console/depfinder

Translate
Lokesh_Shivalingaiah
Level 10
Oct 16, 2015 2:27 AM UTC

I think, solr is already a part of AEM, so when you mention the dependency , you can have the <scope> as 'provided' instead of compile. 

Just check if that resolves the issue

Translate
gopalKaAdobe EmployeeAccepted solution
Adobe Employee
Oct 16, 2015 2:27 AM UTC

AEM already integrates with solr. Please have a look at http://docs.adobe.com/docs/en/aem/6-0/deploy/upgrade/queries-and-indexing.html . So solrj is already present as a bundle in AEM. In any case, i suggest you leverage the OOB integration. The OOB integration also respects the ACLs when it fetches from the indexes. You have to handle that if you query directly.

Translate