Hi Erik

I think I didn't explain my requirement well.

Search based on Rest (Get) should have the below steps internally


1.       Rest Search --> 2. Call an external service --> 3. Get Results --> 4. 
Update document --> 5. Rest Search

The main issue here is we are updating a document (subscription details) in 
step 4, which will affect the actual search results.

The real time example would be as below:

1.       User performed search hitting the URL v1/search?q=reading (got 1000 
results)

2.       User performed search hitting the URL v1/search?q=reading (got 20 
results) only because steps 2 to 4 have updated a subscription document which 
should modify the query parameters internally as (v1/search?q=reading AND 
(ID:123 OR ID:2343 OR ID:2342)&options=custom-search).

I hope the resource extension is used on document ingestion/retrieval but not 
in the Search service. Correct me if I am wrong here.

Gnana

Gnanaprakash Bodireddy | Sr. Associate - Projects | IME | Cognizant Technology 
Solutions.
Address: Raheja MindSpace, 7th Floor, Hyderabad.
O: +91 (40) 44514444 extn: 672103| Mobile: +91 8897575644

From: Erik Hennum [mailto:erik.hen...@marklogic.com]
Sent: Monday, January 28, 2013 8:06 PM
To: Bodireddy, Gnanaprakash (Cognizant); general@developer.marklogic.com
Subject: RE: Using ML6 Rest-API with dependancy on other services

Hi, Gnanaprakash:

The best approach might be to write a resource service extension that does 
steps 2 through 4 as one request.  Then, when the ingestion request finishes, 
do step 5 as a standard REST search request.

That way, the ingested documents will be available to all searchers at the 
earliest possible time and you won't have to use an eval to put the document 
inserts and search in separate transactions.

The details about writing a resource service extension are explained here:

    http://docs.marklogic.com/guide/rest-dev/extensions

If you need to ingest a large number of documents, you might need to ingest 
batches of documents in separate transactions.  InfoStudio collectors and the 
infodev:transaction() function can be helpful for that task.  In particular, 
the collector-feed.xqy collector could be a model for an approach that _might_ 
work for you:

    https://github.com/marklogic/infostudio-plugins/tree/master/collectors

If you need to ingest document batches asynchronously, the client might need to 
poll the server (checking the ticket status, if you're using the InfoStudio 
functions) to determine whether ingestion is complete.

Erik Hennum
________________________________
From: 
gnanaprakash.bodire...@cognizant.com<mailto:gnanaprakash.bodire...@cognizant.com>
 [gnanaprakash.bodire...@cognizant.com]
Sent: Monday, January 28, 2013 2:10 AM
To: general@developer.marklogic.com<mailto:general@developer.marklogic.com>; 
Erik Hennum
Subject: Using ML6 Rest-API with dependancy on other services
Hi Erik,

I am having a requirement to Search based on

1.       Rest API Call --> 2. Call an external service --> 3. Get Results --> 
4. Ingest transformed document --> 5. Perform Rest API Search


Note: the search will be effected drastically based on step 4 (sometimes based 
on condition steps 2 to 4 will be optional)

Previously, I am using Corona and I have tweaked Corona to handle this case.

But, as I got suggestions not to tweak the Rest API modules is there any other 
way where I can achieve the above process?

Thanks in Advance :)

Thanks and Regards,

Gnanaprakash Bodireddy

This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful.
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful.
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to