[opencms-dev] How can search general in more perspective/multisite?

Schliemann, Kai K.Schliemann at comundus.com
Mon Oct 6 16:02:49 CEST 2014


Hi Deiverson,
in this case you can use the method setSearchRoot(String searchRoot) of class CmsSearch to set a folder which should be used as root folder.
    /**
     * Convenience method to set exactly one search root.<p>
     *
     * @param searchRoot the search root to set
     *
     * @see #setSearchRoots(String[])
     */
    public void setSearchRoot(String searchRoot) {

        setSearchRoots(CmsStringUtil.splitAsArray(searchRoot, ","));
    }

HTH
Best regards
Kai



Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Deiverson Silveira
Gesendet: Montag, 6. Oktober 2014 14:55
An: The OpenCms mailing list
Betreff: Re: [opencms-dev] How can search general in more perspective/multisite?

Hi Kai,

But this way, for a global search on all subsites I would have to instantiate each index and concatenate the results, right?
Regards,

Deiverson

2014-10-06 6:21 GMT-03:00 Schliemann, Kai <K.Schliemann at comundus.com<mailto:K.Schliemann at comundus.com>>:
Hi Deiverson,
if you are using Lucene, you can create an index for each site.
And then set the index in your search JSP.
e.g. like
org.opencms.search.CmsSearch.setIndex(indexName);
AFAIK OpenCms provides a property “search.index”. You could use that to read the index you need. Or set it hard coded in your template, depending on the site you are in (not recommended).

HTH

Best regards
Kai

Von: opencms-dev-bounces at opencms.org<mailto:opencms-dev-bounces at opencms.org> [mailto:opencms-dev-bounces at opencms.org<mailto:opencms-dev-bounces at opencms.org>] Im Auftrag von Deiverson Silveira
Gesendet: Freitag, 3. Oktober 2014 20:54
An: The OpenCms mailing list
Betreff: Re: [opencms-dev] How can search general in more perspective/multisite?

Hi Fabian,
Thank you for attention.

I don't use Solr, you know how can make this using Lucene? I use traditional Lucene, I think this case is already a good opportunity to use Solr and leave the Lucene.
I try set my object with project "/" but entry conflit in mysite because perspective:

        CmsObject cmsObject = cms.getCmsObject();
        CmsProject cmsproject = cmsObject.readProject("Offline");
        cmsObject.getRequestContext().setCurrentProject(cmsproject);
        cmsObject.getRequestContext().setSiteRoot("/");
and:
search.init(cmsproject);

Regards,

Deiverson

2014-10-01 8:57 GMT-03:00 fhsubscriptions at componio.net<mailto:fhsubscriptions at componio.net> <fhsubscriptions at componio.net<mailto:fhsubscriptions at componio.net>>:
Hi Deiverson,

you can set the "parent sites" in the Solr query to enable search across different sites.

Regards,

\Fabian

Am 01.10.2014 13:24, schrieb Deiverson Silveira:
Hi List,
I have problem.
I have multisites, and I have search general, I need search /sites/siteA/news/ and /sites/siteB/news/.
I stay perspective /sites/siteA/, dont see /sites/siteB/

My search don´t work because perspective, how can solved this problem?
I need help,
Regards,

Deiverson


--
www.solutioncms.com<http://www.solutioncms.com>
The Brazilian
Official Provider OpenCms


_______________________________________________

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








_______________________________________________
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





--
www.solutioncms.com<http://www.solutioncms.com>
The Brazilian
Official Provider OpenCms

_______________________________________________
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






--
www.solutioncms.com<http://www.solutioncms.com>
The Brazilian
Official Provider OpenCms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20141006/7448738b/attachment.htm>


More information about the opencms-dev mailing list