Is there any difference between SiteService methods listSites and findSites

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
mbel
Active Member II

Is there any difference between SiteService methods listSites and findSites

Jump to solution

Hello,

Could someone explain if there is any difference between the listSites and findSites methods in SiteService when I want to list ALL sites:

List<SiteInfo> listSites = this.siteService.listSites(null, null);

List<SiteInfo> findSites = this.siteService.findSites("*", 0);

Is it possible findSites not to return sometimes all sites?

I used that method but when I created a new Site programatically before calling that method, it doesn't find it at all.

Is it possible the result between listSites and findSites to be different in the above example?

Thank you in advance.

1 Solution

Accepted Solutions
afaust
Master

Re: Is there any difference between SiteService methods listSites and findSites

Jump to solution

The main difference is in how the filter is applied. listSites only supports retrieving sites where the name / title starts with a specific value where as findSites supports a any-match use case. listSites is designed to make use of DB-based lookups whereas findSites may use index-based queries. This would explain the behaviour you are seeing - since SOLR indexing is asynchronous you may not immediately find a newly created site via findSites.

1 Reply
afaust
Master

Re: Is there any difference between SiteService methods listSites and findSites

Jump to solution

The main difference is in how the filter is applied. listSites only supports retrieving sites where the name / title starts with a specific value where as findSites supports a any-match use case. listSites is designed to make use of DB-based lookups whereas findSites may use index-based queries. This would explain the behaviour you are seeing - since SOLR indexing is asynchronous you may not immediately find a newly created site via findSites.