Hi,

See 
http://extensions.xwiki.org/xwiki/bin/view/Extension/Solr+Search+Query+API#HFromJava

Thanks
-Vincent

On 11 Aug 2015 at 13:28:08, Eduard Moraru 
([email protected](mailto:[email protected])) wrote:

> Hi,
>  
> You need to use XWiki's Query Module [1].
>  
> Here's a quick howto:
>  
> Make sure your maven module's pom.xml depends on the
> org.xwiki.platform:xwiki-platform-search-solr-query module in order to have
> the right classes in your classpath.
>  
> Then, you could do something along these lines:
>  
> // declare the dependency injection in the code
> @Inject
> org.xwiki.query.QueryManager queryManager;
>  
> // use it to create a query
> org.xwiki.query.Query query = queryManager.creatQuery("your query
> statement", "solr");
> // bind more values to the query
> query.bindValue("whateverYouWantToAdd", value);
> // execute the query
> org.apache.solr.client.solrj.response.QueryResponse response =
> query.execute().get(0);
> // use the response to get the information you need.
> response.getResults();
> // etc.
>  
> Hope this helps,
> Eduard
>  
> [1]
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module#HFromJavacomponents
>  
>  
>  
> On Mon, Aug 10, 2015 at 11:54 AM, Peter Huisman wrote:
>  
> > Hi,
> >
> > I have been looking into the Solr search to identify which wiki links
> > ([>>doc:] in TEXTAREA’s within Objects on a page) are being used for a
> > certain document. I want to use this from my Java packages. I have not been
> > able to identify an (easy?) way of incorporating Solr search into this. If
> > I’m not mistaken, it even discouraged to use. It works like a charm in
> > velocity but that’s not where I want to use it.
> >
> > Now, I’m not an expert in Java so maybe I do not have the right knowledge
> > to understand how this works but can you please enlighten me a bit on this
> > topic?
> >
> > With kind regards,
> >
> > Peter
> >
> >
> > _______________________________________________
> > users mailing list
> > [email protected]
> > http://lists.xwiki.org/mailman/listinfo/users
> >
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to