SearchScope 搜索文档
来源:互联网 发布:淘宝联盟官网 编辑:程序博客网 时间:2024/06/06 20:18
文档搜索时FileNet的一个重要功能。有这个功能让客户更加清晰的查看操作过得文档。此文是利用SearchScope进行搜索
查看FileNet的API文档关于SearchScope的介绍如下:
public final class SearchScope
Determines which repository or repositories are to be searched, and supplies methods to execute searches for properties, objects, and class metadata (class descriptions).
When multiple repositories are to be searched, use the SearchScope(ObjectStore[], MergeMode)
constructor to specify whether the scope is the union or intersection of the object stores.
决定从一个存储或者多个存储中查询,并提供方法来执行搜索属性、对象和类的元数据(类描述)。
当多个存储库搜索,使用SearchScope(ObjectStore[],MergeMode)构造函数指定范围是否工会或相交的对象存储。
可以看到SearchScope是提供文档查询的一个Class,下面是代码示例
package CEJavaAPIEDU.Search;import java.util.Iterator;import CEJavaAPIEDU.CEConnectionEDU;import CEJavaAPIEDU.Configurations;import com.filenet.api.collection.DocumentSet;import com.filenet.api.collection.RepositoryRowSet;import com.filenet.api.constants.MergeMode;import com.filenet.api.core.*;import com.filenet.api.property.FilterElement;import com.filenet.api.property.PropertyFilter;import com.filenet.api.query.RepositoryRow;import com.filenet.api.query.SearchSQL;import com.filenet.api.query.SearchScope;public class ContentSearchEDU extends CEConnectionEDU {/** * @param args */public void testContentSearchEDU(ObjectStore os, String keyWord){ SearchScope search = new SearchScope(os); //通过sql语句查询相应的数据 String mySQLString = "SELECT DocumentTitle, Name FROM Document d " +"INNER JOIN VerityContentSearch v ON v.QueriedObject = d.This " +"WHERE d.IsCurrentVersion = TRUE AND CONTAINS(d.*,'" + keyWord + "')"; SearchSQL sql = new SearchSQL(mySQLString); DocumentSet documents = (DocumentSet) search.fetchObjects(sql,Integer.getInteger("50"),null, Boolean.valueOf(true)); com.filenet.api.core.Document doc; Iterator it = documents.iterator(); while (it.hasNext()) { doc = (Document)it.next(); System.out.println("document="+ doc.get_Name()); }}public static void main(String[] args) {// TODO Auto-generated method stubtry { ContentSearchEDU myInstance = new ContentSearchEDU();//与上一篇博文建立CE连接有关 Connection conn = myInstance.getCEConnectionEDU(); //获取连接 Domain domain = myInstance.getDomainEDU(conn); //取得域 ObjectStore store = myInstance.getObjectStoreEDU(domain, Configurations.DefalutOS1); myInstance.testContentSearchEDU(store,"test"); System.out.println("Done"); } catch (Exception e) { e.printStackTrace(); }}}
fetchObjects(SearchSQL searchSQL, java.lang.Integer pageSize, PropertyFilter filter, java.lang.Boolean continuable)
Retrieves EngineObject
objects from the repository or repositories specified for this instance.
searchSQL
可以理解为查询条件
pageSize也比较简单,就是查询出的记录数。
这个方法也比较简单通过查询相应的API可以迅速的使用,
下面把该方法的介绍和注意事项贴到下面,感兴趣的可以看一下,不过都是英文的
public IndependentObjectSet fetchObjects(SearchSQL searchSQL, java.lang.Integer pageSize, PropertyFilter filter, java.lang.Boolean continuable)
- Retrieves
EngineObject
objects from the repository or repositories specified for this instance.The following property settings can affect this method:
ObjectStore.DefaultQueryTimeLimit
ObjectStore.MaxQueryTimeLimit
ServerCacheCofiguration.QueryPageMaxSize
ServerCacheCofiguration.QueryPageDefaultSize
ServerCacheCofiguration.NonPagedQueryMaxSize
You can optionally include a filter to control which properties to return with the object. If you pass in
null
for thefilter
parameter, this method returns values for all non-object properties and returns placeholders for all object-valued properties. For more information, see the description of thefilter
parameter. - Parameters:
searchSQL
- ASearchSQL
instance containing the SQL statement to use for the search.pageSize
- An integer indicating the maximum number of objects per page to retrieve. This can benull
. When unspecified, the default page size (ServerCacheCofiguration.QueryPageDefaultSize
) is used.Note: If the
continuable
parameter isfalse
ornull
, thispageSize
value is ignored.The number you specify here determines what constitutes a page of query result data. This value, in conjunction with the (Boolean) value you specify for the continuable parameter, can impact retrieval performance.
filter
- APropertyFilter
object that represents information for controlling which property values (and with what level of detail and recursion) to return. Ifnull
, this method returns values for all non-object properties and returns placeholders for all object-valued properties (PropertyEngineObject
properties with a state ofPropertyState.UNEVALUATED
orPropertyState.REFERENCE
); any subsequent attempts to access an object-valued property will cause an automatic round-trip to the server to fetch its value.The selection list in the
searchSQL
parameter determines which top-level properties are returned. The property filter specified here determines the subproperties: the properties returned for the applicable top-level properties. For example, if a top-level property specified in the selection list (searchSQL
parameter) is of typeObject
, the filter parameter will determine which properties are returned in that object.continuable
- ABoolean
value. Iffalse
ornull
, the query is not paged, thepageSize
parameter and the default page size inServerCacheCofiguration.QueryPageDefaultSize
are ignored, and the query will return a number of objects limited by the following values:- The "TOP" value (if specified) in the selection list.
- The value of
ServerCacheCofiguration.NonPagedQueryMaxSize
.
If this
continuable
value istrue
, the query can be continued. In this case, when the end of the first page is reached, a request for the next page ofEngineObject
objects is issued. Page requests iterate until all of theEngineObject
objects satisfying the query are retrieved.Queries using continuation use ORDER BY in their implementation. If an ORDER BY clause is not specified in the SQL statement (the
searchSQL
parameter), an ORDER BY Id clause is used. If an ORDER BY clause is specified in the SQL statement, but does not contain the Id property, the Id property (having a unique value) is appended to the end of the ORDER BY clause. You should to what extent adding the Id property to the ORDER BY clause increases resource consumption for your application. Do not use a continuable query if it would cause a severe performance reduction.- Returns:
- An
IndependentObjectSet
collection object containing theEngineObject
objects retrieved. - See Also:
- SQL Syntax Reference
有了API查询还是比较简单的,不过如果负责的查询SQL语句还是关键的。sql语句是基础,把基础掌握好,其他的还是比较简单的,比如上面的方法如果会写sql语句,上面的API有了相应的介绍使用起来就很简单了。千万不要忽略基础的东西。
- SearchScope 搜索文档
- CSDN文档搜索
- 搜索特定几个文档
- XML文档搜索使用小结
- RFC文档类搜索(中英文)
- XML文档搜索使用小结
- XML文档搜索使用小结
- XML文档搜索使用小结
- XML文档搜索使用小结
- XML文档搜索使用小结
- 【技术文档】百度搜索技巧
- 国内外主流文档搜索网站
- 如何搜索salesforce相关文档
- coreseek搜索使用指导文档。
- MongoDB文档翻译-文本搜索
- 实战baidu搜索的大型文档海量搜索系统
- 使用DataSet和DataView搜索XML文档
- 用asp编写文档搜索页面
- android之intent的Flag详解
- [Andriod官方训练教程]创建你的第一个App之创建一个简单的用户界面
- 音频帧概念详解
- 优先队列的使用
- 英语学习2013/2/28
- SearchScope 搜索文档
- 安装wamp后打开phpmyadmin时显示You don't have permission to access
- 《Linux设备驱动程序》读书笔记:字符设备驱动程序(一)
- CSS Hack
- WinForm界面开发之布局控件"WeifenLuo.WinFormsUI.Docking"的使用
- ubuntu下关闭触摸板
- 使用命令查看自己的外网IP地址 .
- Maven环境搭建
- android通过httpPost向服务器发送请求 .