Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

maven dependency issue for FTS

Avatar

Level 5

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.

1 Accepted Solution

Avatar

Correct answer by
Employee

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.

View solution in original post

7 Replies

Avatar

Correct answer by
Employee

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.

Avatar

Level 10

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

Avatar

Employee

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

/system/console/depfinder

Avatar

Level 5

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.

Avatar

Level 5

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

Avatar

Employee

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

Avatar

Level 5

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.