Gopal Thakur
Gopal Thakur

Reputation: 227

Time limit exceeded , in Markligic Cts:Search

I have about 53,00,000 document in my marklogic server and each document contains one record.

xquery version "1.0-ml";
  declare namespace pa = "http://www.contata.com/pa";  
  let $query :=  
         cts:or-query((  
            cts:element-word-query(  
              xs:QName("pa:name"), "SMITH"  
            ),  
            cts:element-word-query(  
              xs:QName("pa:address-1"),  ""   
            ),  
            cts:element-word-query(  
              xs:QName("pa:address-2"),  ""   
            ),
            cts:element-word-query(   
              xs:QName("pa:address-3"),  ""   
            ),  
             cts:element-word-query(  
              xs:QName("pa:city"),  ""   
            )  
                    )) return   

cts:search(fn:doc(),$query)[5100000 to 5300000]

when I execute above mentioned query it takes and long time to execute and gives the following error

[1.0-ml] XDMP-EXTIME: cts:search(fn:doc(), cts:or-query((cts:element-word-query(xs:QName("pa:name"), "SMITH", ("lang=en"), 1), cts:element-word-query(xs:QName("pa:address-1"), "", ("lang=en"), 1), cts:element-word-query(xs:QName("pa:address-2"), "", ("lang=en"), 1), ...))) -- Time limit exceeded

but when I execute cts:search(fn:doc(),$query)[1000 to 2000] it executes succesfully.

One More question, if I have loaded all my documents then how can I create indexes on them after loading from RecordLoader Utility.

Upvotes: 3

Views: 868

Answers (2)

mblakele
mblakele

Reputation: 7842

Look into the 'unfiltered' option, and also consider using 'search:search'.

You could also increase the time limit, but probably won't want to. With filtered search getting to the 500000th result requires checking 500000 documents, which may require up to 500000 disk reads. If your disk can manage 100 every second, that is 5000 seconds.

Upvotes: 4

grtjn
grtjn

Reputation: 20414

You are showing 200.000 search results. Try to show less at once. If you'd use Query Console or CQ profiler, you would see that not cts:search is taking so much time, but getting those 200k docs.

HTH!

Upvotes: 1

Related Questions