For years people have been working around some of the basic limitations of content systems.
Even the simple task of search (find me *that*!) was very hard because content was in files all over the place or stored in difficult to search relational databases.
The purpose built seach engines that filled the gap have gotten us to a pretty decent place: we can, in most cases, find something that contains *that*.
But a bit like AMC creating the AMX out of the Hornet, the search engines developed to bridge the gap don't address the core problem (it's a HORNET!).
This is because search engines are add-on applications, external to the content.
And just like the AMX begat all kinds of spin-offs (AMX GT, AMX/400 . . . the Gremlin), the search engines have expanded into wider and wider functionality . . . but they have still not really addressed the problem (it's still a HORNET!!).
Enter XQuery and MarkLogic Server - a real platform for content and search.
XQuery can query across large volumes of XML content, MarkLogic Server is an XML repository and an XQuery engine (including full text search).
This is the place for *you* to create your own search application.
This is an *entire* MarkLogic Server search engine application, complete with formatting and snippets:
let $term := xdmp:get-request-field("term")
return
<ul>
{for $play in cts:search(xdmp:directory("/content/bill/", "infinity"), $term)
return
<li><b>{fn:string($play/PLAY/TITLE)}</b>
<br/>{for $line in ($play//LINE[cts:contains(., $term)])[1 to 5]
return
<p>{$line}</p>
}
</li>
}</ul>
(*works on the content loaded in the tutorial.)
It is tailored to the content, delivers a precise result . . . and, whats more, can be fully customized.
If you want to boost relevance according to the content's structure, you just change the search term a bit:
cts:search(xdmp:directory("/content/bill/", "infinity"),
cts:or-query( (cts:element-word-query(xs:QName("TITLE"), $term, (), 10), $term)))
Now if the phrase appears in the TITLE element it will get a relevance boost of 10.
Or if you want to return a more granular element - say all the speeches, then you can simply search on that structure:
<ul>
{for $speech in
cts:search(xdmp:directory("/content/bill/", "infinity")//SPEECH, $term)
return
<li>
<b>{fn:string($speech/ancestor::PLAY/TITLE)}</b> -
{fn:string($speech/ancestor::ACT/TITLE)}
<br/>Speaker: {$speech/SPEAKER}
<br/>{for $line in $speech/LINE
return
<p>{$line}</p>
}
</li>
}
</ul>
MarkLogic Server is built on the native structure of the XML. There is no extra configuration or added work to do this fine grained, precise search.
Instead of a Bizzarrini AMX/3 this is a Ford GT (positively NOT a Hornet) - a search application built on the platform for content.
P.S. for your reference:
Comments