请问NotesView.FTSearch和DB.Search中的查询字符串写法有什么不同啊?

sweetywang 2005-10-13 09:48:50
如题。
新手上路,多多指教。
...全文
1639 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
sweetywang 2005-10-17
  • 打赏
  • 举报
回复
但是在formula中再加上视图的搜索条件,还是用db.search。这样我对不同视图的搜索就要写不同的代理啊?因为视图的搜索条件不一样。有没有什么方法可以直接获取当前视图的搜索条件,写个通用的搜索呢?
sweetywang 2005-10-14
  • 打赏
  • 举报
回复
Dim Session As New NotesSession
Dim dbCur As NotesDatabase
Dim dc As NotesDocumentCollection
Dim docCur As NotesDocument
Dim View As NotesView
Dim doc As Notesdocument
Set dbCur = Session.currentdatabase
Set docCur = Session.documentcontext
Dim dt As New NotesDateTime("")

'设置搜索条件:一个组合查询,查找人姓名,开始时间,结束时间。 ApplyName,FromDate,ToDate为AFLForm中的域;docCur.KeyWord(0),docCur.DateFrom(0),docCur.DateTo(0)为用户输入的搜索条件

Dim formula As String
formula="(form="""+"AFLForm"+""")"

If docCur.KeyWord(0)<>"" Then'
formula=formula+"&(ApplyName="""+docCur.KeyWord(0)+""")"
End If


'开始时间
If docCur.DateFrom(0)<>"" Then
a=Trim(Format$(docCur.DateFrom(0),"yyyy-mm-dd hh:nn"))
formula=formula+"&(FromDate=>["+a+"])"
End If
'结束时间
If docCur.DateTo(0)<>"" Then
b=Trim(Format$(docCur.DateTo(0),"yyyy-mm-dd hh:nn"))
formula=formula+"&(ToDate<=["+b+"])"
End If


'这样实现数据库搜索
Set dc = dbCur.search(formula,dt,0)

'清空搜索文件夹
Set View = dbCur.getView("SearchResult")
If Not View Is Nothing Then
Set doc = View.getfirstdocument
While Not doc Is Nothing
Call doc.removefromfolder("SearchResult")
Set doc = View.getfirstdocument
Wend
End If


'把搜索结果放入文件夹中
Call dc.PutAllInFolder("SearchResult")


实现数据库搜索是正确的,现在我想用同样的搜索条件实现对当前视图的搜索,该怎么做呢?NotesView.FTSearch(query,0)中的query该怎么写呢?与上面的db.search中的formula不一样啊?
hanwenjuan3 2005-10-14
  • 打赏
  • 举报
回复
一个是在指定的视图中查询,另外一个是在整个数据库中查询。范围不一样。数据库中包括很多视图!
sweetywang 2005-10-14
  • 打赏
  • 举报
回复
这个问题已解决,只要在formula中再加上视图的搜索条件,还是用db.search就可以了。
NotesView.FTSearch(query,0)中query是关键字,不能用这样的搜索条件对吗?
sweetywang 2005-10-13
  • 打赏
  • 举报
回复
不要沉啊!!
问题很菜,但我不会啊。。各位高手帮帮忙啊!

535

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧