How to build a simple search application in Marklogic?

无人久伴 提交于 2019-12-01 23:42:42

问题


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.


回答1:


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

You can even use braces, AND, OR, and NOT in that expression.

More about the Search API can be found in the Search Dev guide:

http://docs.marklogic.com/guide/search-dev

The function reference is probably useful too:

http://docs.marklogic.com/search

And for the sake of completeness the REST-API is worth mentioning too:

http://docs.marklogic.com/REST/client/search

HTH!




回答2:


And, past the search and xquery knowledge, you can take a look at Roxy, which will set up a simple App-Builder style MVC application in xquery, sort of like Ruby on Rails.




回答3:


I also recommend that you read some fo the tutorials at http://developer.marklogic.com/learn/tutorials. In particular I recommend you read the two part series starting with http://developer.marklogic.com/learn/get-started-apps. That will show you the basics for writing an application in MarkLogic. From there you can apply the search:search functionality mentioned by grtjn.



来源:https://stackoverflow.com/questions/10292707/how-to-build-a-simple-search-application-in-marklogic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!