maven dependency issue for FTS | Community
Skip to main content
Level 4
October 16, 2015
Solved

maven dependency issue for FTS

  • October 16, 2015
  • 7 replies
  • 1398 views

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.
Best answer by gopalKa

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

gopalKaAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

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.

Lokesh_Shivalingaiah
Level 10
October 16, 2015

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

Feike_Visser1
Adobe Employee
Adobe Employee
October 16, 2015

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

/system/console/depfinder

asn11Author
Level 4
October 16, 2015

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.

asn11Author
Level 4
October 16, 2015

<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...

Adobe Employee
October 16, 2015

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.

asn11Author
Level 4
October 16, 2015

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.