[opencms-dev] Solr autocomplete/suggester
Stephan Schrader
zstephanz at gmail.com
Fri Jan 25 12:15:27 CET 2019
Hi Theo,
we did this once with help of reflection. At the end the code could look
like this:
CmsObject cmsObject;
String query;
CmsSolrIndex searchIndex = CmsSearchManager.getIndexSolr(cmsObject,
null);
Field solr = CmsSolrIndex.class.getDeclaredField("m_solr");
solr.setAccessible(true);
SolrServer solrServer = (SolrServer) solr.get(searchIndex);
SolrQuery q = new SolrQuery(query);
q.setRequestHandler("/suggest");
q.addFilterQuery("expired:[NOW TO *]");
QueryResponse queryResponse = solrServer.query(q);
Another solution would be to deploy a Solr Webapp and use the configuration
/ index provided by OpenCms. That way you could use Solr HTTP-API.
Stephan
Am Mi., 23. Jan. 2019 um 17:40 Uhr schrieb Fabian Huschka <hfcoma at gmx.de>:
> Hi,
>
> I am rather new to OpenCms so I am not sure if OpenCms really can do this.
> I am running an 10.5.4 installation with the jsp-search-formatter for the
> Solr search.
> I want to add an autocomplete/suggestion while typing in keywords however
> the Solr server is masqueraded by OpenCms so I have no idea how to reach
> the /suggest-URL for a configured suggester in solrconfig.xml
> Any hints/pointers on how to achieve this?
>
> Many thanks,
>
> Theo
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20190125/d20eb204/attachment.htm>
More information about the opencms-dev
mailing list