Hello All,

I have cloned the MarkLogic World Leaders app and reconfigured it to point to 
my Employee's MarkLogic database (ParProc).
I implemented and tested a search query in the Query Console that returns the 
corresponding data elements (see QueryConsole.txt attachment).

I wanted to include this search in the web application.  However, I am not able 
to retrieve any values for display.  It's as if the for loop is not recognizing 
the node list.  Within the index.xqy I wrote the results to the log and they 
look correct but I am not able to retrieve values for display.  The $firstname 
remains empty (see modified index.xqy attachment).

See searchResults.txt attachment.  I would appreciate some guidance on what I 
might be missing.

Thanks,
Javier


import module namespace search = "http://marklogic.com/appservices/search"; 
  at "/MarkLogic/appservices/search/search.xqy";

let $options := <options xmlns="http://marklogic.com/appservices/search";>
  <additional-query>
      {cts:and-query((cts:element-range-query(xs:QName("WORK_DATE"), ">=", 
xs:dateTime("2014-08-01T00:00:00")), 
cts:element-range-query(xs:QName("WORK_DATE"), "<",
      xs:dateTime("2014-09-08T00:00:00"))))}
  </additional-query>
  <extract-document-data>
      <extract-path>/Root/PROCEDURE/FIRST_NAME</extract-path>
      <extract-path>/Root/PROCEDURE/LAST_NAME</extract-path>
      <extract-path>/Root/PROCEDURE/DESCRIPTION</extract-path>
      <extract-path>/Root/PROCEDURE/WORK_DATE</extract-path>
      <extract-path>/Root/PROCEDURE/INCIDENT_ID</extract-path>
      <extract-path>/Root/PROCEDURE/INCIDENT_NAME</extract-path>
      <extract-path>/Root/PROCEDURE/QUANTITY</extract-path>
  </extract-document-data>   
  <return-facets>true</return-facets>
  <return-metrics>true</return-metrics>
  <return-results>true</return-results>
  <transform-results apply="empty-snippet" />
  <page-length>5</page-length>
      <sort-order type="xs:dateTime" direction="ascending">
        <element name="WORK_DATE"/>
      </sort-order>
  <search-option>unfiltered</search-option>
</options>
let $emp := search:search("(Bachala OR Chakka OR Kompelly OR Lasseter)", 
$options)
for $employee in $emp
let $firstname := $employee//FIRST_NAME/text()
        return $firstname
<search:response snippet-format="empty-snippet" total="666" start="1" 
page-length="5" selected="include" 
xmlns:search="http://marklogic.com/appservices/search";>
<search:result index="1" uri="/par/400085.xml" path="fn:doc("/par/400085.xml")" 
score="26304" confidence="0.2540611" fitness="0.3910294">
<search:snippet>
</search:snippet>
<search:extracted kind="element">
<INCIDENT_ID>30506
</INCIDENT_ID>
<WORK_DATE>2014-08-06T00:00:00
</WORK_DATE>
<QUANTITY>6.2800
</QUANTITY>
<DESCRIPTION>Kenexa-LMS Policy Review, Document Webvan Log process, Network 
Issue 3 Month Report
</DESCRIPTION>
<INCIDENT_ID>30506
</INCIDENT_ID>
<INCIDENT_NAME>Enterprise Shared Services - Application Maintenance and Support 
Services
</INCIDENT_NAME>
<FIRST_NAME>Stephen
</FIRST_NAME>
<LAST_NAME>Lasseter
</LAST_NAME>
</search:extracted>
</search:result>
<search:result index="2" uri="/par/400199.xml" path="fn:doc("/par/400199.xml")" 
score="26304" confidence="0.2540611" fitness="0.3910294">
<search:snippet>
</search:snippet>
<search:extracted kind="element">
<INCIDENT_ID>30506
</INCIDENT_ID>
<WORK_DATE>2014-08-06T00:00:00
</WORK_DATE>
<QUANTITY>1.7200
</QUANTITY>
<DESCRIPTION>Network Issue 3 Month Report - combing through support emails
</DESCRIPTION>
<INCIDENT_ID>30506
</INCIDENT_ID>
<INCIDENT_NAME>Enterprise Shared Services - Application Maintenance and Support 
Services
</INCIDENT_NAME>
<FIRST_NAME>Stephen
</FIRST_NAME>
<LAST_NAME>Lasseter
</LAST_NAME>
</search:extracted>
</search:result>
<search:result index="3" uri="/par/400360.xml" path="fn:doc("/par/400360.xml")" 
score="26304" confidence="0.2540611" fitness="0.3910294">
<search:snippet>
</search:snippet>
<search:extracted kind="element">
<INCIDENT_ID>30506
</INCIDENT_ID>
<WORK_DATE>2014-08-06T00:00:00
</WORK_DATE>
<QUANTITY>1.6000
</QUANTITY>
<DESCRIPTION>Network Report
</DESCRIPTION>
<INCIDENT_ID>30506
</INCIDENT_ID>
<INCIDENT_NAME>Enterprise Shared Services - Application Maintenance and Support 
Services
</INCIDENT_NAME>
<FIRST_NAME>Stephen
</FIRST_NAME>
<LAST_NAME>Lasseter
</LAST_NAME>
</search:extracted>
</search:result>
<search:result index="4" uri="/par/400121.xml" path="fn:doc("/par/400121.xml")" 
score="19264" confidence="0.2170297" fitness="0.3340338">
<search:snippet>
</search:snippet>
<search:extracted kind="element">
<INCIDENT_ID>30805
</INCIDENT_ID>
<WORK_DATE>2014-08-06T00:00:00
</WORK_DATE>
<QUANTITY>0.5800
</QUANTITY>
<DESCRIPTION>Analyzed on the common solution related to : OLIVER / TDS China IP

</DESCRIPTION>
<INCIDENT_ID>30805
</INCIDENT_ID>
<INCIDENT_NAME>Oliver TMO Sustainment
</INCIDENT_NAME>
<FIRST_NAME>Bala
</FIRST_NAME>
<LAST_NAME>Kompelly
</LAST_NAME>
</search:extracted>
</search:result>
<search:result index="5" uri="/par/400197.xml" path="fn:doc("/par/400197.xml")" 
score="19264" confidence="0.2170297" fitness="0.3340338">
<search:snippet>
</search:snippet>
<search:extracted kind="element">
<INCIDENT_ID>30805
</INCIDENT_ID>
<WORK_DATE>2014-08-06T00:00:00
</WORK_DATE>
<QUANTITY>0.5000
</QUANTITY>
<DESCRIPTION>Worked on IslandPacific RM13292470

</DESCRIPTION>
<INCIDENT_ID>30805
</INCIDENT_ID>
<INCIDENT_NAME>Oliver TMO Sustainment
</INCIDENT_NAME>
<FIRST_NAME>Bala
</FIRST_NAME>
<LAST_NAME>Kompelly
</LAST_NAME>
</search:extracted>
</search:result>
<search:qtext>(Bachala OR Chakka OR Kompelly OR Lasseter)
</search:qtext>
<search:metrics>
<search:query-resolution-time>PT0.006S
</search:query-resolution-time>
<search:facet-resolution-time>PT0S
</search:facet-resolution-time>
<search:snippet-resolution-time>PT0S
</search:snippet-resolution-time>
<search:total-time>PT0.01S
</search:total-time>
</search:metrics>
</search:response>

Attachment: index.xqy
Description: index.xqy

_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to