Reputation: 1048
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.
Upvotes: 3
Views: 396
Reputation: 20414
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!
Upvotes: 5
Reputation: 321
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.
Upvotes: 3
Reputation: 392
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.
Upvotes: 2