2012-09-06 75 views
1

我在xquery這樣(和事務,搜索,業務)有一個單詞序列。現在我想在文檔(如pdf,doc,ppt)以及xml文件中搜索這個序列。如果任何單詞中的任何一個單詞匹配,那麼應返回該文檔的URIMarklogicxquery這樣做最有效的方法是什麼?如何搜索Marklogic文檔中的單詞序列?

回答

0

聽起來好像第一個問題是從用戶提供的字符串中標記出單詞。這裏有一個簡單的方法來做到這一點使用cts:tokenizehttp://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/apidoc/SearchBuiltins.xml&category=SearchBuiltins&function=cts:tokenize

cts:tokenize('now is the time')[. instance of cts:word] 

一旦你的話,你可以用cts:word-query構造和cts:search使用它們,否則你可能會延長高層次的搜索API來處理這個問題:可能使用search:resolvehttp://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/apidoc/searchapi.xml&category=Search&function=search:resolve

當然任何二進制內容(PDF,DOC,PPT)將需要的文檔轉換第一:http://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/xml/search-dev-guide/binary-document-metadata.xml

相關問題