如何在Marklogic中构建一个简单的搜索应用程序? [英] How to build a simple search application in Marklogic?
问题描述
我想在Marklogic中构建一个简单的搜索应用程序,但是我不想使用Application Builder.我想编写自己的.xqy文件.我想接受用户说名字,姓氏和名字"的输入地址.用户可以按名字,姓氏或地址进行搜索.他还可以通过输入所有三个字段进行搜索,也可以将三个字段留空.在这种情况下(空白),应返回所有记录.如何在Marklogic的特定节点(例如名字,姓氏等)上使用搜索工具在Marklogic中构建此类应用程序.
I want to build a simple search application in Marklogic but I don't want to use Application Builder. I want to write my own .xqy files. I want to take input from user say First Name, Last Name & Address. The user can search by First Name, or Last Name or Address. He can also search by entering all the three fields or can also leave three fields blank. In that case (blank) all the records should be returned. How can I build such application in Marklogic with search facility on specific nodes of xml like First Name, Last Name etc.
推荐答案
我建议您看看search:search
功能.它提供了分页和开箱即用的多面搜索.您也不需要三个搜索框,您可以使用前缀编写字段搜索查询.像这样:
I suggest you take a look at the search:search
functionality. It provides pagination, and faceted searching out of the box. You don't need three search boxes either, you can write fielded search queries using prefixes. Something like this:
fulltextterm first:name last:name address:city
您甚至可以在该表达式中使用花括号, AND , OR 和 NOT .
You can even use braces, AND, OR, and NOT in that expression.
有关Search API
的更多信息可以在Search Dev指南中找到:
More about the Search API
can be found in the Search Dev guide:
http://docs.marklogic.com/guide/search-dev
函数引用也可能有用:
http://docs.marklogic.com/search
出于完整性考虑,REST-API
也值得一提:
And for the sake of completeness the REST-API
is worth mentioning too:
http://docs.marklogic.com/REST/client/search
HTH!
这篇关于如何在Marklogic中构建一个简单的搜索应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!