Use the controlled list to build a 4000-term or-query. If you like, you can
store it that way in the database as cts query XML. Then use cts:highlight or
cts:walk to find any matches in the new document. Note that this will work fine
with in-memory XML: you won't necessarily have to insert the document first.
Since the vocabulary list is fixed, runtime will be proportional to the new
document size.
For example:
cts:walk(
$new-document,
cts:query(doc('vocabulary-list.xml')/*),
element match { attribute term { $cts:queries }, $cts:node })
Ensure that 'match' is an element that never appears in $new-document.
Namespaces can help with that.
-- Mike
On 24 May 2012, at 09:05 , <[email protected]> wrote:
> I have a requirement where the end user would like to add “tags” to
> individual documents.
>
> I’m maintaining a separate domain specific list of terms which I suggest to
> the user as potential tags they can select to apply to the document.
>
> This list of terms is around 4000 items long. And it will continue to grow.
>
> What I want to do ->
>
> 1. user creates a document
> 2. execute a search against that document with each of these 4000 terms
> 3. use results to suggest tags to the user that are already part of the
> document, so they don’t have to think of them on their own
>
> I tried running search:search 4000 times against the one document. It just
> timed out (which makes sense)
>
> I know there has to be a better way to do this. Any suggestions?
>
> Thanks!
>
> Matt
> _______________________________________________
> General mailing list
> [email protected]
> http://community.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://community.marklogic.com/mailman/listinfo/general