incorporating APLAWS patch
r1672 | chrisg23 | 2007-09-19 16:52:52 +0200 (Mi, 19 Sep 2007) Sourceforge patch 1797953 - remote search changes. No effect by default (though I think we are the only people using remote search anyway) git-svn-id: https://svn.libreccm.org/ccm/trunk@30 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
42133caec0
commit
7ec05e633f
|
|
@ -43,7 +43,7 @@ public class SimpleCategoryFilterWidget extends CategoryFilterWidget {
|
|||
/**
|
||||
* Creates a new category filter
|
||||
*/
|
||||
protected SimpleCategoryFilterWidget() {
|
||||
public SimpleCategoryFilterWidget() {
|
||||
m_roots = new Category[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,10 @@ public class RemoteSearcher extends Thread {
|
|||
if (results != null && !results.isEmpty()) {
|
||||
s_log.debug("about to add results to the searchgroup");
|
||||
job.getGroup().addResults( results );
|
||||
} else {
|
||||
// Need to add empty results to register completion
|
||||
// of one servers search.
|
||||
job.getGroup().addResults(Collections.EMPTY_LIST);
|
||||
}
|
||||
} catch( RemoteException ex ) {
|
||||
s_log.error( "Failure making SOAP call to " + url + ": " +
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import com.arsdigita.search.QuerySpecification;
|
|||
import com.arsdigita.search.ResultSet;
|
||||
import com.arsdigita.search.Document;
|
||||
import com.arsdigita.search.filters.PermissionFilterSpecification;
|
||||
import com.arsdigita.search.filters.ContentSectionFilterSpecification;
|
||||
import com.arsdigita.london.util.Transaction;
|
||||
import com.arsdigita.cms.search.VersionFilterSpecification;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
|
|
@ -59,12 +60,21 @@ public class SOAPHandler {
|
|||
if (com.arsdigita.search.Search.getConfig().isIntermediaEnabled()) {
|
||||
spec.addFilter(new PermissionFilterSpecification());
|
||||
}
|
||||
|
||||
String[] sections = Search.getConfig().getRemoteSearchContentSections();
|
||||
if (sections != null) {
|
||||
spec.addFilter(new ContentSectionFilterSpecification(sections));
|
||||
}
|
||||
|
||||
spec.addFilter(new VersionFilterSpecification(ContentItem.LIVE));
|
||||
|
||||
ResultSet resultSet = com.arsdigita.search.Search.processInternal(
|
||||
spec,
|
||||
com.arsdigita.search.Search.getConfig().getIndexer());
|
||||
Iterator docs = resultSet.getDocuments(0, 50);
|
||||
|
||||
// Get max. number of remote results as specified in config. param.
|
||||
Iterator docs = resultSet.getDocuments(0,
|
||||
Search.getConfig().getMaxRemoteResults().longValue());
|
||||
|
||||
s_log.debug("About to return results for query: " + terms);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.arsdigita.runtime.AbstractConfig;
|
|||
import com.arsdigita.util.parameter.BooleanParameter;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.IntegerParameter;
|
||||
import com.arsdigita.util.parameter.StringArrayParameter;
|
||||
import com.arsdigita.util.parameter.StringParameter;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
|
@ -43,6 +44,8 @@ public final class SearchConfig extends AbstractConfig {
|
|||
private final Parameter m_numThreads;
|
||||
private final Parameter m_searchTimeout;
|
||||
private final Parameter m_showSponsoredLinks;
|
||||
private final Parameter m_maxRemoteResults;
|
||||
private final Parameter m_remoteSearchContentSections;
|
||||
|
||||
private final Parameter m_simpleRestrictTo;
|
||||
private String[] simpleRestrictToArray;
|
||||
|
|
@ -57,6 +60,12 @@ public final class SearchConfig extends AbstractConfig {
|
|||
m_showSponsoredLinks = new BooleanParameter
|
||||
("com.arsdigita.london.search.show_sponsored_links",
|
||||
Parameter.REQUIRED, Boolean.FALSE);
|
||||
m_maxRemoteResults = new IntegerParameter
|
||||
("com.arsdigita.london.search.max_remote_results",
|
||||
Parameter.REQUIRED, new Integer(50));
|
||||
m_remoteSearchContentSections = new StringArrayParameter
|
||||
("com.arsdigita.london.search.remote_search_content_sections",
|
||||
Parameter.OPTIONAL, null);
|
||||
m_simpleRestrictTo = new StringParameter
|
||||
("com.arsdigita.london.search.simple_restrict_to",
|
||||
Parameter.OPTIONAL, "");
|
||||
|
|
@ -64,6 +73,8 @@ public final class SearchConfig extends AbstractConfig {
|
|||
register(m_numThreads);
|
||||
register(m_searchTimeout);
|
||||
register(m_showSponsoredLinks);
|
||||
register(m_maxRemoteResults);
|
||||
register(m_remoteSearchContentSections);
|
||||
register(m_simpleRestrictTo);
|
||||
loadInfo();
|
||||
}
|
||||
|
|
@ -82,10 +93,27 @@ public final class SearchConfig extends AbstractConfig {
|
|||
return (Boolean) get(m_showSponsoredLinks);
|
||||
}
|
||||
|
||||
public final Integer getMaxRemoteResults() {
|
||||
return (Integer) get(m_maxRemoteResults);
|
||||
}
|
||||
|
||||
public final String getSimpleRestrictTo() {
|
||||
return (String) get(m_simpleRestrictTo);
|
||||
}
|
||||
|
||||
/**
|
||||
* When this server is the target of a remote search, this
|
||||
* parameter enables us to filter by content section - so for
|
||||
* example, we can prevent results from subsites being
|
||||
* available externally is we specify the main site content
|
||||
* section. If parameter is unset, then all content sections
|
||||
* are searched
|
||||
* @return
|
||||
*/
|
||||
public final String[] getRemoteSearchContentSections() {
|
||||
return (String[])get(m_remoteSearchContentSections);
|
||||
}
|
||||
|
||||
public final String[] getSimpleRestrictToArray() {
|
||||
if (simpleRestrictToArray == null) {
|
||||
loadSimpleRestrictToArray();
|
||||
|
|
|
|||
|
|
@ -11,3 +11,14 @@ com.arsdigita.london.search.show_sponsored_links.title=Show Sponsored Links
|
|||
com.arsdigita.london.search.show_sponsored_links.purpose=Whether or not to display Sponsored Links in addition to search results
|
||||
com.arsdigita.london.search.show_sponsored_links.example=false
|
||||
com.arsdigita.london.search.show_sponsored_links.format=[boolean]
|
||||
|
||||
com.arsdigita.london.search.max_remote_results.title=Number of Remote Search Results to Return
|
||||
com.arsdigita.london.search.max_remote_results.purpose=What is the maximum number of remote search results this server should return
|
||||
com.arsdigita.london.search.max_remote_results.example=50
|
||||
com.arsdigita.london.search.max_remote_results.format=[integer]
|
||||
|
||||
com.arsdigita.london.search.remote_search_content_sections.title=Content Sections for Remote Search
|
||||
com.arsdigita.london.search.remote_search_content_sections.purpose=When this host is a target for remote search, filter results to specified content sections
|
||||
com.arsdigita.london.search.remote_search_content_sections.example=content,forms
|
||||
com.arsdigita.london.search.remote_search_content_sections.format=[string,string,string]
|
||||
|
||||
|
|
|
|||
|
|
@ -62,8 +62,15 @@ public class AdvancedQueryComponent extends BaseQueryComponent {
|
|||
|
||||
Application app = Web.getContext().getApplication();
|
||||
Category root = Category.getRootForObject(app);
|
||||
add(new SimpleCategoryFilterWidget(root));
|
||||
// cg - if no default domain mapped to search application, don't
|
||||
// display widget. Also, allows implementations that use advanced search
|
||||
// without the advanced search UI to work without default mapping
|
||||
if (root != null) {
|
||||
|
||||
add(new SimpleCategoryFilterWidget(root));
|
||||
} else {
|
||||
add(new SimpleCategoryFilterWidget());
|
||||
}
|
||||
add(new ContentTypeFilterWidget());
|
||||
add(new VersionFilterComponent(context));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue