mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
svn merge -r 2570:2595 svn://www.alfresco.org/alfresco/BRANCHES/V1.2.0/root HEAD/root
svn merge -r 2597:2649 svn://www.alfresco.org/alfresco/BRANCHES/V1.2.0/root HEAD/root git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2650 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
<config>
|
<config>
|
||||||
<client>
|
<client>
|
||||||
<from-email-address>someone@your-domain.com</from-email-address>
|
<from-email-address>someone@your-domain.com</from-email-address>
|
||||||
|
<search-max-results>100</search-max-results>
|
||||||
</client>
|
</client>
|
||||||
</config>
|
</config>
|
||||||
-->
|
-->
|
||||||
|
@@ -764,8 +764,8 @@ home_space_name=Home Space Name
|
|||||||
title_admin_console=Administration Console
|
title_admin_console=Administration Console
|
||||||
admin_console=Administration Console
|
admin_console=Administration Console
|
||||||
admin_description=Use this view to perform system administration functions.
|
admin_description=Use this view to perform system administration functions.
|
||||||
admin_limited_license=Licensed: {0} license issued on {1,date,short} limited to {2} days expiring {3,date,short} ({4} days remaining).
|
admin_limited_license=Licensed: {0} license granted to {1} and limited to {3} days expiring {4,date,short} ({5} days remaining - issued on {2,date,short}).
|
||||||
admin_unlimited_license=Licensed: {0} license issued on {1,date,short} (does not expire).
|
admin_unlimited_license=Licensed: {0} license granted to {1} and does not expire (issued on {2,date,short}).
|
||||||
admin_invalid_license=Licensed: LICENSE INVALID - Alfresco Repository restricted to read-only capability.
|
admin_invalid_license=Licensed: LICENSE INVALID - Alfresco Repository restricted to read-only capability.
|
||||||
|
|
||||||
# UI Page Titles
|
# UI Page Titles
|
||||||
|
@@ -39,6 +39,13 @@
|
|||||||
<!-- the minimum number of characters required for a valid search string -->
|
<!-- the minimum number of characters required for a valid search string -->
|
||||||
<search-minimum>3</search-minimum>
|
<search-minimum>3</search-minimum>
|
||||||
|
|
||||||
|
<!-- set this value to true to enable AND text terms for simple/advanced search by default -->
|
||||||
|
<search-and-terms>false</search-and-terms>
|
||||||
|
|
||||||
|
<!-- Limit search results. -1 for unlimited. -->
|
||||||
|
<search-max-results>-1</search-max-results>
|
||||||
|
|
||||||
|
|
||||||
<!-- The default permissions to apply to a new users Home Space when first created -->
|
<!-- The default permissions to apply to a new users Home Space when first created -->
|
||||||
<!-- this permission is for other users attempting to access that Home Space -->
|
<!-- this permission is for other users attempting to access that Home Space -->
|
||||||
<!-- generally set to "Consumer" or empty value to indicate a private hidden space. -->
|
<!-- generally set to "Consumer" or empty value to indicate a private hidden space. -->
|
||||||
@@ -138,6 +145,7 @@
|
|||||||
|
|
||||||
<config evaluator="string-compare" condition="Advanced Search">
|
<config evaluator="string-compare" condition="Advanced Search">
|
||||||
<!-- advanced search custom attribute config -->
|
<!-- advanced search custom attribute config -->
|
||||||
|
<!-- see http://wiki.alfresco.com/wiki/Advanced_Search_Custom_Attributes -->
|
||||||
<advanced-search>
|
<advanced-search>
|
||||||
<!-- type constraint drop-down -->
|
<!-- type constraint drop-down -->
|
||||||
<content-types>
|
<content-types>
|
||||||
|
@@ -686,8 +686,12 @@ public class AdvancedSearchBean
|
|||||||
// then simply navigating to the browse screen will cause it pickup the Search Context
|
// then simply navigating to the browse screen will cause it pickup the Search Context
|
||||||
SearchContext search = new SearchContext();
|
SearchContext search = new SearchContext();
|
||||||
|
|
||||||
|
// set the full-text/name field value
|
||||||
search.setText(this.text);
|
search.setText(this.text);
|
||||||
|
|
||||||
|
// set whether to force AND operation on text terms
|
||||||
|
search.setForceAndTerms(Application.getClientConfig(FacesContext.getCurrentInstance()).getForceAndTerms());
|
||||||
|
|
||||||
if (this.mode.equals(MODE_ALL))
|
if (this.mode.equals(MODE_ALL))
|
||||||
{
|
{
|
||||||
search.setMode(SearchContext.SEARCH_ALL);
|
search.setMode(SearchContext.SEARCH_ALL);
|
||||||
|
@@ -43,8 +43,10 @@ import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.Path;
|
import org.alfresco.service.cmr.repository.Path;
|
||||||
|
import org.alfresco.service.cmr.search.LimitBy;
|
||||||
import org.alfresco.service.cmr.search.ResultSet;
|
import org.alfresco.service.cmr.search.ResultSet;
|
||||||
import org.alfresco.service.cmr.search.ResultSetRow;
|
import org.alfresco.service.cmr.search.ResultSetRow;
|
||||||
|
import org.alfresco.service.cmr.search.SearchParameters;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -679,9 +681,20 @@ public class BrowseBean implements IContextListener
|
|||||||
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
|
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
|
||||||
tx.begin();
|
tx.begin();
|
||||||
|
|
||||||
results = this.searchService.query(
|
// Limit search to the first 100 matches
|
||||||
Repository.getStoreRef(),
|
SearchParameters sp = new SearchParameters();
|
||||||
SearchService.LANGUAGE_LUCENE, query, null, null);
|
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
|
||||||
|
sp.setQuery(query);
|
||||||
|
sp.addStore(Repository.getStoreRef());
|
||||||
|
|
||||||
|
int searchLimit = Application.getClientConfig(FacesContext.getCurrentInstance()).getSearchMaxResults();
|
||||||
|
if(searchLimit > 0)
|
||||||
|
{
|
||||||
|
sp.setLimitBy(LimitBy.FINAL_SIZE);
|
||||||
|
sp.setLimit(searchLimit);
|
||||||
|
}
|
||||||
|
|
||||||
|
results = this.searchService.query(sp);
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Search results returned: " + results.length());
|
logger.debug("Search results returned: " + results.length());
|
||||||
|
|
||||||
|
@@ -119,6 +119,9 @@ public final class SearchContext implements Serializable
|
|||||||
/** any additional fixed value attributes to add to the search, such as boolean or noderef */
|
/** any additional fixed value attributes to add to the search, such as boolean or noderef */
|
||||||
private Map<QName, String> queryFixedValues = new HashMap<QName, String>(5, 1.0f);
|
private Map<QName, String> queryFixedValues = new HashMap<QName, String>(5, 1.0f);
|
||||||
|
|
||||||
|
/** set true to force the use of AND between text terms */
|
||||||
|
private boolean forceAndTerms = false;
|
||||||
|
|
||||||
/** logger */
|
/** logger */
|
||||||
private static Log logger = LogFactory.getLog(SearchContext.class);
|
private static Log logger = LogFactory.getLog(SearchContext.class);
|
||||||
|
|
||||||
@@ -217,6 +220,9 @@ public final class SearchContext implements Serializable
|
|||||||
term = term.substring(1);
|
term = term.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// special case for AND all terms if set (apply after operator character removed)
|
||||||
|
operatorAND = operatorAND | this.forceAndTerms;
|
||||||
|
|
||||||
if (term.length() != 0)
|
if (term.length() != 0)
|
||||||
{
|
{
|
||||||
// operators such as AND and OR are only make sense for full text searching
|
// operators such as AND and OR are only make sense for full text searching
|
||||||
@@ -654,6 +660,22 @@ public final class SearchContext implements Serializable
|
|||||||
return this.queryFixedValues.get(qname);
|
return this.queryFixedValues.get(qname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns if AND is forced between text terms. False (OR terms) is the default.
|
||||||
|
*/
|
||||||
|
public boolean getForceAndTerms()
|
||||||
|
{
|
||||||
|
return this.forceAndTerms;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param forceAndTerms Set true to force AND between text terms. Otherwise OR is the default.
|
||||||
|
*/
|
||||||
|
public void setForceAndTerms(boolean forceAndTerms)
|
||||||
|
{
|
||||||
|
this.forceAndTerms = forceAndTerms;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return this SearchContext as XML
|
* @return this SearchContext as XML
|
||||||
*
|
*
|
||||||
|
@@ -34,6 +34,8 @@ public class ClientConfigElement extends ConfigElementAdapter
|
|||||||
private int recentSpacesItems = 6;
|
private int recentSpacesItems = 6;
|
||||||
private boolean shelfVisible = true;
|
private boolean shelfVisible = true;
|
||||||
private int searchMinimum = 3;
|
private int searchMinimum = 3;
|
||||||
|
private boolean forceAndTerms = false;
|
||||||
|
private int searchMaxResults = -1;
|
||||||
private String helpUrl = null;
|
private String helpUrl = null;
|
||||||
private String editLinkType = "http";
|
private String editLinkType = "http";
|
||||||
private String homeSpacePermission = null;
|
private String homeSpacePermission = null;
|
||||||
@@ -121,6 +123,16 @@ public class ClientConfigElement extends ConfigElementAdapter
|
|||||||
newElement.setSearchMinimum(existingElement.getSearchMinimum());
|
newElement.setSearchMinimum(existingElement.getSearchMinimum());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (existingElement.getForceAndTerms() != newElement.getForceAndTerms())
|
||||||
|
{
|
||||||
|
newElement.setForceAndTerms(existingElement.getForceAndTerms());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existingElement.getSearchMaxResults() != newElement.getSearchMaxResults())
|
||||||
|
{
|
||||||
|
newElement.setSearchMaxResults(existingElement.getSearchMaxResults());
|
||||||
|
}
|
||||||
|
|
||||||
if (existingElement.isShelfVisible() != newElement.isShelfVisible())
|
if (existingElement.isShelfVisible() != newElement.isShelfVisible())
|
||||||
{
|
{
|
||||||
newElement.setShelfVisible(existingElement.isShelfVisible());
|
newElement.setShelfVisible(existingElement.isShelfVisible());
|
||||||
@@ -263,6 +275,44 @@ public class ClientConfigElement extends ConfigElementAdapter
|
|||||||
{
|
{
|
||||||
this.searchMinimum = searchMinimum;
|
this.searchMinimum = searchMinimum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return If true enables AND text terms for simple/advanced search by default.
|
||||||
|
*/
|
||||||
|
public boolean getForceAndTerms()
|
||||||
|
{
|
||||||
|
return this.forceAndTerms;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param forceAndTerms True to enable AND text terms for simple/advanced search by default.
|
||||||
|
*/
|
||||||
|
/*package*/ void setForceAndTerms(boolean forceAndTerms)
|
||||||
|
{
|
||||||
|
this.forceAndTerms = forceAndTerms;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If positive, this will limit the size of the result set from the search.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
public int getSearchMaxResults()
|
||||||
|
{
|
||||||
|
return searchMaxResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if the the result set from a search will be of limited size.
|
||||||
|
* If negative it is unlimited, by convention, this is set to -1.
|
||||||
|
*
|
||||||
|
* @param searchMaxResults
|
||||||
|
*/
|
||||||
|
/*package*/ void setSearchMaxResults(int searchMaxResults)
|
||||||
|
{
|
||||||
|
this.searchMaxResults = searchMaxResults;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the default Home Space permissions.
|
* @return Returns the default Home Space permissions.
|
||||||
|
@@ -34,6 +34,8 @@ public class ClientElementReader implements ConfigElementReader
|
|||||||
public static final String ELEMENT_HELPURL = "help-url";
|
public static final String ELEMENT_HELPURL = "help-url";
|
||||||
public static final String ELEMENT_EDITLINKTYPE = "edit-link-type";
|
public static final String ELEMENT_EDITLINKTYPE = "edit-link-type";
|
||||||
public static final String ELEMENT_SEARCHMINIMUM = "search-minimum";
|
public static final String ELEMENT_SEARCHMINIMUM = "search-minimum";
|
||||||
|
public static final String ELEMENT_SEARCHANDTERMS = "search-and-terms";
|
||||||
|
public static final String ELEMENT_SEARCHMAXRESULTS = "search-max-results";
|
||||||
public static final String ELEMENT_HOMESPACEPERMISSION = "home-space-permission";
|
public static final String ELEMENT_HOMESPACEPERMISSION = "home-space-permission";
|
||||||
public static final String ELEMENT_FROMEMAILADDRESS = "from-email-address";
|
public static final String ELEMENT_FROMEMAILADDRESS = "from-email-address";
|
||||||
public static final String ELEMENT_SHELFVISIBLE = "shelf-visible";
|
public static final String ELEMENT_SHELFVISIBLE = "shelf-visible";
|
||||||
@@ -93,6 +95,20 @@ public class ClientElementReader implements ConfigElementReader
|
|||||||
configElement.setSearchMinimum(Integer.parseInt(searchMin.getTextTrim()));
|
configElement.setSearchMinimum(Integer.parseInt(searchMin.getTextTrim()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get the search force AND terms setting
|
||||||
|
Element searchForceAnd = element.element(ELEMENT_SEARCHANDTERMS);
|
||||||
|
if (searchForceAnd != null)
|
||||||
|
{
|
||||||
|
configElement.setForceAndTerms(Boolean.parseBoolean(searchForceAnd.getTextTrim()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the search max results size
|
||||||
|
Element searchMaxResults = element.element(ELEMENT_SEARCHMAXRESULTS);
|
||||||
|
if (searchMaxResults != null)
|
||||||
|
{
|
||||||
|
configElement.setSearchMaxResults(Integer.parseInt(searchMaxResults.getTextTrim()));
|
||||||
|
}
|
||||||
|
|
||||||
// get the default permission for newly created users Home Spaces
|
// get the default permission for newly created users Home Spaces
|
||||||
Element permission = element.element(ELEMENT_HOMESPACEPERMISSION);
|
Element permission = element.element(ELEMENT_HOMESPACEPERMISSION);
|
||||||
if (permission != null)
|
if (permission != null)
|
||||||
|
@@ -132,6 +132,7 @@ public class UISimpleSearch extends UICommand
|
|||||||
*/
|
*/
|
||||||
public void broadcast(FacesEvent event) throws AbortProcessingException
|
public void broadcast(FacesEvent event) throws AbortProcessingException
|
||||||
{
|
{
|
||||||
|
FacesContext fc = getFacesContext();
|
||||||
if (event instanceof SearchEvent)
|
if (event instanceof SearchEvent)
|
||||||
{
|
{
|
||||||
// update the component parameters from the search event details
|
// update the component parameters from the search event details
|
||||||
@@ -141,6 +142,7 @@ public class UISimpleSearch extends UICommand
|
|||||||
SearchContext context = new SearchContext();
|
SearchContext context = new SearchContext();
|
||||||
context.setText(searchEvent.SearchText);
|
context.setText(searchEvent.SearchText);
|
||||||
context.setMode(searchEvent.SearchMode);
|
context.setMode(searchEvent.SearchMode);
|
||||||
|
context.setForceAndTerms(Application.getClientConfig(fc).getForceAndTerms());
|
||||||
this.search = context;
|
this.search = context;
|
||||||
|
|
||||||
super.broadcast(event);
|
super.broadcast(event);
|
||||||
@@ -149,7 +151,6 @@ public class UISimpleSearch extends UICommand
|
|||||||
{
|
{
|
||||||
// special case to navigate to the advanced search screen
|
// special case to navigate to the advanced search screen
|
||||||
AdvancedSearchEvent searchEvent = (AdvancedSearchEvent)event;
|
AdvancedSearchEvent searchEvent = (AdvancedSearchEvent)event;
|
||||||
FacesContext fc = getFacesContext();
|
|
||||||
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, searchEvent.Outcome);
|
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, searchEvent.Outcome);
|
||||||
|
|
||||||
// NOTE: we don't call super() here so that our nav outcome is the one that occurs!
|
// NOTE: we don't call super() here so that our nav outcome is the one that occurs!
|
||||||
|
Reference in New Issue
Block a user