[英]How to search the given text into marklogic XHTML file, like clt+f
[英]How to load the xhtml document as a text and search the keyword in marklogic
我已经在marklogic中加载了XHTML文件。 但是需要对属性,元素和文本执行搜索。 因此,我需要以文本形式获取/加载文档并在文档上执行搜索。
以下是XHTML文件。
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<meta>
</meta>
<body class="Default">
</body>
</html>
Using below code I am ble to save text file but it will aloow to save (>0.2KB )small size file. I need to save upto 1 to 50MB files in marklogic DB.
Using below code I am able to save file as text but big file not able to save.
ContentCreateOptions createOptions = ContentCreateOptions.newTextInstance();
Content content = ContentFactory.newContent("/"+uID,filetext, createOptions);
mlSession.insertContent(content);
仍然不太确定背后的用例,但是您可以执行以下操作:
如果您真的想完整地搜索元素名称,属性和文本的全文,最好不要在提取时将其作为文本插入。 例如,类似:
xdmp:document-insert(
"/my.xhtml",
text {
xdmp:quote(
<html xmlns="http://www.w3.org/1999/xhtml">
...
</html>
)
}
)
要么:
xdmp:document-load(
"/server/path/to/my.xhtml",
<options xmlns="xdmp:document-load">
<format>text</format>
</options>
)
之后,您可以简单地执行以下操作:
cts:search(collection(), "mytagorattrorterm")
或者,您可以在执行cts:contains或fn:contains之前使用xdmp:quote,但是伸缩性很差,因此最好只在一个或几个文档上同时执行。
HTH!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.