Matt,

I thought of this solution before I saw Mike's post, but this *would* require 
that the document be inserted first. It leverages the word lexicon, so it 
should be fairly fast, although it still took a while when I tried something 
similar using local content.

(for $w in
cts:words((),(),
  cts:and-query((
    cts:document-query($user-doc-uri),
    cts:word-query((doc('terms.xml')//term/string()))
order by (cts:frequency($w))
retrun $w)[1 to 20]

-Will

From: [email protected] 
[mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Thursday, May 24, 2012 9:05 AM
To: [email protected]
Subject: [MarkLogic Dev General] Keyword matching strategy

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

Reply via email to