Java Doc for CmsSearchParameters.java in  » Content-Management-System » opencms » org » opencms » search » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » opencms » org.opencms.search 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.opencms.search.CmsSearchParameters

CmsSearchParameters
public class CmsSearchParameters (Code)
Contains the search parameters for a call to org.opencms.search.CmsSearchIndex.search(org.opencms.file.CmsObjectCmsSearchParameters) .

Primary purpose is translation of search arguments to response parameters and from request parameters as well as support for creation of restrictions of several search query parameter sets.


author:
   Alexander Kandzior
version:
   $Revision: 1.12 $
since:
   6.0.0



Field Summary
final public static  SortSORT_DATE_CREATED
     Sort result documents by date of creation, then score.
final public static  SortSORT_DATE_LASTMODIFIED
     Sort result documents by date of last modification, then score.
final public static  SortSORT_DEFAULT
     Default sort order (by document score - for this null gave best performance).
final public static  String[]SORT_NAMES
     Names of the default sort options.
final public static  SortSORT_TITLE
     Sort result documents by title, then score.
protected  intm_displayPages
     The number of displayed pages returned by getPageLinks().
protected  intm_matchesPerPage
     The number of matches per page.

Constructor Summary
public  CmsSearchParameters()
     Creates a new search parameter instance with no search query and default values for the remaining parameters.
public  CmsSearchParameters(String query)
     Creates a new search parameter instance with the provided search query and default values for the remaining parameters.
public  CmsSearchParameters(String query, List fields, List roots, List categories, boolean calculateCategories, Sort sort)
    

Method Summary
public  booleangetCalculateCategories()
     Returns wether category counts are calculated for search results or not.
public  ListgetCategories()
    
public  intgetDisplayPages()
    
public  ListgetFields()
    
public  StringgetIndex()
    
public  intgetMatchesPerPage()
    
public  longgetMaxDateCreated()
    
public  longgetMaxDateLastModified()
    
public  longgetMinDateCreated()
    
public  longgetMinDateLastModified()
    
public  StringgetQuery()
    
public  intgetQueryLength()
    
public  ListgetRoots()
    
public  StringgetSearchCategories()
    
public  CmsSearchIndexgetSearchIndex()
     Returns the search index to search in or null if not set before ( CmsSearchParameters.setSearchIndex(CmsSearchIndex) ).
public  intgetSearchPage()
    
public  StringgetSearchRoots()
     Returns the comma separated lists of root folder names to restrict search to.

This method is a "sibling" to method CmsSearchParameters.getRoots() but with the support of being useable with widget technology.

public  SortgetSort()
     Returns the instance that defines the sort order for the results.
public  StringgetSortName()
    
public  booleanisCalculateCategories()
    
public  booleanisExcerptOnlySearchedFields()
     Returns true if fields configured for the excerpt should be used for generating the excerpt only if they have been actually searched in.

The default setting is false, which means all text fields configured for the excerpt will be used to gernerate the excerpt, regardless if they have been searched in or not.

Please note: A field will only be included in the excerpt if it has been configured as excerpt="true" in opencms-search.xml.

public  CmsSearchParametersrestrict(CmsSearchParameters restriction)
     Creates a merged parameter set from this parameters, restricted by the given other parameters.

This is mainly intended for "search in search result" functions.

The restricted query is build of the queries of both parameters, appended with AND.

The lists in the restriction for CmsSearchParameters.getFields() , CmsSearchParameters.getRoots() and CmsSearchParameters.getCategories() are intersected with the lists of this search parameters.

public  voidsetCalculateCategories(boolean flag)
    
public  voidsetCategories(List categories)
     Set the list of categories (strings) to this parameters.
public  voidsetDisplayPages(int value)
    
public  voidsetExcerptOnlySearchedFields(boolean excerptAllFields)
    
public  voidsetFields(List fields)
     Sets the list of strings of names of fields to search in.
public  voidsetIndex(String indexName)
    
public  voidsetMatchesPerPage(int matches)
    
public  voidsetMaxDateCreated(long dateCreatedTo)
    
public  voidsetMaxDateLastModified(long dateLastModifiedTo)
    
public  voidsetMinDateCreated(long dateCreatedFrom)
    
public  voidsetMinDateLastModified(long dateLastModifiedFrom)
    
public  voidsetQuery(String query)
     Sets the query to search for.
public  voidsetQueryLength(int length)
    
public  voidsetRoots(List roots)
    
public  voidsetSearchCategories(String categories)
    
public  voidsetSearchIndex(CmsSearchIndex index)
     Sets the search index to use for the search.
public  voidsetSearchPage(int page)
     Set the search page to display.
public  voidsetSearchRoots(String rootNameList)
    
public  voidsetSort(Sort sortOrder)
     Set the instance that defines the sort order for search results.
public  voidsetSortName(String sortName)
     Sets the internal member of type Sort according to the given sort name.
public  StringtoQueryString()
    
public  StringtoString()
    

Field Detail
SORT_DATE_CREATED
final public static Sort SORT_DATE_CREATED(Code)
Sort result documents by date of creation, then score.



SORT_DATE_LASTMODIFIED
final public static Sort SORT_DATE_LASTMODIFIED(Code)
Sort result documents by date of last modification, then score.



SORT_DEFAULT
final public static Sort SORT_DEFAULT(Code)
Default sort order (by document score - for this null gave best performance).



SORT_NAMES
final public static String[] SORT_NAMES(Code)
Names of the default sort options.



SORT_TITLE
final public static Sort SORT_TITLE(Code)
Sort result documents by title, then score.



m_displayPages
protected int m_displayPages(Code)
The number of displayed pages returned by getPageLinks().



m_matchesPerPage
protected int m_matchesPerPage(Code)
The number of matches per page.




Constructor Detail
CmsSearchParameters
public CmsSearchParameters()(Code)
Creates a new search parameter instance with no search query and default values for the remaining parameters.

Before using this search parameters for a search method CmsSearchParameters.setQuery(String) has to be invoked.




CmsSearchParameters
public CmsSearchParameters(String query)(Code)
Creates a new search parameter instance with the provided search query and default values for the remaining parameters.

Only the "meta" field (combination of content and title) will be used for search. No search root restriction is chosen. No category restriction is used. No categorie counts are calculated for the result. Sorting is turned off. This is a simple but fast setup.


Parameters:
  query - the query to search for




CmsSearchParameters
public CmsSearchParameters(String query, List fields, List roots, List categories, boolean calculateCategories, Sort sort)(Code)
Creates a new search parameter instance with the provided parameter values.


Parameters:
  query - the search term to search the index
Parameters:
  fields - the list of fields to search
Parameters:
  roots - only resource that are sub-resource of one of the search roots are included in the search result
Parameters:
  categories - the list of categories to limit the search to
Parameters:
  calculateCategories - if true, the category count is calculated for all search results(use with caution, this option uses much performance)
Parameters:
  sort - the sort order for the search





Method Detail
getCalculateCategories
public boolean getCalculateCategories()(Code)
Returns wether category counts are calculated for search results or not.

a boolean that tells wether category counts are calculated for search results or not




getCategories
public List getCategories()(Code)
Returns the list of categories to limit the search to.

the list of categories to limit the search to




getDisplayPages
public int getDisplayPages()(Code)
Returns the maximum number of pages which should be shown.

the maximum number of pages which should be shown




getFields
public List getFields()(Code)
Returns the list of search index field names (Strings) to search in.

the list of search index field names (Strings) to search in




getIndex
public String getIndex()(Code)
Get the name of the index for the search.

the name of the index for the search




getMatchesPerPage
public int getMatchesPerPage()(Code)
Gets the number of matches displayed on each page.

matches per result page




getMaxDateCreated
public long getMaxDateCreated()(Code)
Returns the creation date the resources have to have as maximum.

the creation date the resources have to have as maximum




getMaxDateLastModified
public long getMaxDateLastModified()(Code)
Returns the last modification date the resources have to have as maximum.

the last modification date the resources have to have as maximum




getMinDateCreated
public long getMinDateCreated()(Code)
Returns the creation date the resources have to have as minimum.

the creation date the resources have to have as minimum




getMinDateLastModified
public long getMinDateLastModified()(Code)
Returns the last modification date the resources have to have as minimum.

the last modification date the resources have to have as minimum




getQuery
public String getQuery()(Code)
Returns the search query to use.

the search query to use




getQueryLength
public int getQueryLength()(Code)
Gets the minimum search query length.

the minimum search query length




getRoots
public List getRoots()(Code)
Returns the list of strings of search roots to use.

Only resource that are sub-resource of one of the search roots are included in the search result.

the list of strings of search roots to use




getSearchCategories
public String getSearchCategories()(Code)
Returns the list of categories to limit the search to.

the list of categories to limit the search to




getSearchIndex
public CmsSearchIndex getSearchIndex()(Code)
Returns the search index to search in or null if not set before ( CmsSearchParameters.setSearchIndex(CmsSearchIndex) ).

the search index to search in or null if not set before (CmsSearchParameters.setSearchIndex(CmsSearchIndex))




getSearchPage
public int getSearchPage()(Code)
Returns the search page to display.

the search page to display




getSearchRoots
public String getSearchRoots()(Code)
Returns the comma separated lists of root folder names to restrict search to.

This method is a "sibling" to method CmsSearchParameters.getRoots() but with the support of being useable with widget technology.

the comma separated lists of field names to search in
See Also:   CmsSearchParameters.setSortName(String)




getSort
public Sort getSort()(Code)
Returns the instance that defines the sort order for the results. the instance that defines the sort order for the results



getSortName
public String getSortName()(Code)
Returns the name of the sort option being used.

the name of the sort option being used
See Also:   CmsSearchParameters.SORT_NAMES
See Also:   CmsSearchParameters.setSortName(String)




isCalculateCategories
public boolean isCalculateCategories()(Code)
Returns true if the category count is calculated for all search results.

true if the category count is calculated for all search results




isExcerptOnlySearchedFields
public boolean isExcerptOnlySearchedFields()(Code)
Returns true if fields configured for the excerpt should be used for generating the excerpt only if they have been actually searched in.

The default setting is false, which means all text fields configured for the excerpt will be used to gernerate the excerpt, regardless if they have been searched in or not.

Please note: A field will only be included in the excerpt if it has been configured as excerpt="true" in opencms-search.xml. This method controls if so configured fields are used depending on the fields searched, see CmsSearchParameters.setFields(List) .

true if fields configured for the excerpt should be used for generating the excerpt only if they have been actually searched in




restrict
public CmsSearchParameters restrict(CmsSearchParameters restriction)(Code)
Creates a merged parameter set from this parameters, restricted by the given other parameters.

This is mainly intended for "search in search result" functions.

The restricted query is build of the queries of both parameters, appended with AND.

The lists in the restriction for CmsSearchParameters.getFields() , CmsSearchParameters.getRoots() and CmsSearchParameters.getCategories() are intersected with the lists of this search parameters. Only elements containd in both lists are included for the created search parameters. If a list in either the restriction or in this search parameters is null, the list from the other search parameters is used direclty.

The values for CmsSearchParameters.isCalculateCategories() and CmsSearchParameters.getSort() of this parameters are used for the restricted parameters.


Parameters:
  restriction - the parameters to restrict this parameters with the restricted parameters




setCalculateCategories
public void setCalculateCategories(boolean flag)(Code)
Set wether category counts shall be calculated for the corresponding search results or not.


Parameters:
  flag - true if category counts shall be calculated for the corresponding search results or false if not




setCategories
public void setCategories(List categories)(Code)
Set the list of categories (strings) to this parameters.


Parameters:
  categories - the list of categories (strings) of this parameters




setDisplayPages
public void setDisplayPages(int value)(Code)
Sets the maximum number of pages which should be shown.

Enter an odd value to achieve a nice, "symmetric" output.


Parameters:
  value - the maximum number of pages which should be shown




setExcerptOnlySearchedFields
public void setExcerptOnlySearchedFields(boolean excerptAllFields)(Code)
Controls if the excerpt from a field is generated only for searched fields, or for all fields (the default).


Parameters:
  excerptAllFields - if true, the excerpt is generated only from the fields actually searched in
See Also:   CmsSearchParameters.isExcerptOnlySearchedFields()




setFields
public void setFields(List fields)(Code)
Sets the list of strings of names of fields to search in.


Parameters:
  fields - the list of strings of names of fields to search in to set




setIndex
public void setIndex(String indexName)(Code)
Set the name of the index to search.


Parameters:
  indexName - the name of the index




setMatchesPerPage
public void setMatchesPerPage(int matches)(Code)
Sets the number of matches per page.


Parameters:
  matches - the number of matches per page




setMaxDateCreated
public void setMaxDateCreated(long dateCreatedTo)(Code)
Sets the creation date the resources have to have as maximum.


Parameters:
  dateCreatedTo - the creation date the resources have to have as maximum to set




setMaxDateLastModified
public void setMaxDateLastModified(long dateLastModifiedTo)(Code)
Sets the last modification date the resources have to have as maximum.


Parameters:
  dateLastModifiedTo - the last modification date the resources have to have as maximum to set




setMinDateCreated
public void setMinDateCreated(long dateCreatedFrom)(Code)
Sets the creation date the resources have to have as minimum.


Parameters:
  dateCreatedFrom - the creation date the resources have to have as minimum to set




setMinDateLastModified
public void setMinDateLastModified(long dateLastModifiedFrom)(Code)
Sets the last modification date the resources have to have as minimum.


Parameters:
  dateLastModifiedFrom - the the last modification date the resources have to have as minimum to set




setQuery
public void setQuery(String query)(Code)
Sets the query to search for.

The decoding here is tailored for query strings that are additionally manually utf-8 encoded at client side (javascript) to get around an issue with special chars in applications that use non- utf-8 encoding (e.g. ISO-8859-1) OpenCms applications. It is not recommended to use this with frontends that don't encode manually as characters like sole "%" (without number suffix) will cause an Exception.


Parameters:
  query - the querye to search for to set




setQueryLength
public void setQueryLength(int length)(Code)
Sets the minimum length of the search query.


Parameters:
  length - the minimum search query length




setRoots
public void setRoots(List roots)(Code)
Sets the list of strings of roots to search under for the search.


Parameters:
  roots - the list of strings of roots to search under for the search to set




setSearchCategories
public void setSearchCategories(String categories)(Code)
Set the comma separated search root names to restrict search to.


Parameters:
  categories - the comma separated category names to restrict search to




setSearchIndex
public void setSearchIndex(CmsSearchIndex index) throws CmsIllegalArgumentException(Code)
Sets the search index to use for the search.


Parameters:
  index - the search index to use for the search to set.
throws:
  CmsIllegalArgumentException - if null is given as argument




setSearchPage
public void setSearchPage(int page)(Code)
Set the search page to display.


Parameters:
  page - the search page to display




setSearchRoots
public void setSearchRoots(String rootNameList)(Code)
Set the comma separated search root names to restrict search to.


Parameters:
  rootNameList - the comma separated search root names to restrict search to




setSort
public void setSort(Sort sortOrder)(Code)
Set the instance that defines the sort order for search results.
Parameters:
  sortOrder - the instance that defines the sort order for search results to set



setSortName
public void setSortName(String sortName)(Code)
Sets the internal member of type Sort according to the given sort name.

For a list of valid sort names, please see CmsSearchParameters.SORT_NAMES .


Parameters:
  sortName - the name of the sort to use
See Also:   CmsSearchParameters.SORT_NAMES




toQueryString
public String toQueryString()(Code)
Creates a query String build from this search parameters for HTML links.

a query String build from this search parameters for HTML links




toString
public String toString()(Code)

See Also:   java.lang.Object.toString



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.