具有许多属性的MarkLogic REST API搜索

时间:2015-06-04 21:11:26

标签: xml rest search marklogic

我需要从MarkLogic REST API调用返回包含特定单词的文档。

理想情况下,我希望这个伪REST API返回以下XML:

http://localhost:8003/v1/search?q=toxic

我认为您可以将以下代码剪切并粘贴到自己的XML文档中,然后在自己的XML服务器上编写代码。

基本上,我希望搜索查询返回类似于文档端点返回的XML的XML。

提前致谢,

比尔

<Encounters xml:lang="en" xmlns="http://www.marklogic.com/vce">
  <Encounter Id="48557" VisitDate="2011-09-03T18:08:11.441179">
    <Referral Date="2010-01-11T05:23:07.1684034" Id="170050"/>
    <Patient Id="127975">
      <FirstName>Patient</FirstName>
      <LastName>1014530</LastName>
      <MaritalStatus>Widowed</MaritalStatus>
    </Patient>
    <Diagnoses>
      <Diagnosis Icd="E840.4" Name="Accident to powered aircraft at takeoff or landing injuring occupant of commercial aircraft (powered) in surface to air transport"/>
      <Diagnosis Icd="839.07" Name="Closed dislocation, seventh cervical vertebra"/>
      <Diagnosis Icd="E841.0" Name="Accident to powered aircraft, other and unspecified, injuring occupant of spacecraft"/>
      <Diagnosis Icd="987.7" Name="Toxic effect of hydrocyanic acid gas"/>
    </Diagnoses>
    <Procedures>
      <Procedure Cpt="65755 " Name=" penetrating (in pseudophakia) "/>
      <Procedure Cpt="68340" Name="REPAIR OF SYMBLEPHARON; DIVISION OF SYMBLEPHARON, WITH OR WITHOUT INSERTION OF CONFORMER OR CONTACT LENS"/>
      <Procedure Cpt="68801" Name="Dilation of lacrimal punctum, with or without irrigation"/>
      <Procedure Cpt="80051 " Name=" 80051 "/>
    </Procedures>
    <Medications>
      <Medication AUI="1177159" CUI="1370597" Name="Miconazole Nitrate 0.02 MG/MG [Aloe Vesta]"/>
    </Medications>
    <VisualAcuities>
      <VisualAcuity Laterality="Left" LogMar="0.6" Scale="Non-Numeric" SnellenValue="80"/>
    </VisualAcuities>
    <Injuries>
      <Injury Cause="Cause" Id="45116" Laterality="Right"/>
    </Injuries>
  </Encounter>
  <Encounter Id="48558" VisitDate="2002-08-23T21:48:59.2324545">
    <Referral Date="2012-01-24T21:52:24.2844466" Id="169313"/>
    <Patient Id="124331">
      <FirstName>Patient</FirstName>
      <LastName>5644425</LastName>
      <MaritalStatus>Not Married</MaritalStatus>
    </Patient>
    <Diagnoses>
      <Diagnosis Icd="831.12" Name="Open posterior dislocation of humerus"/>
      <Diagnosis Icd="863.80" Name="Injury to gastrointestinal tract, unspecified site, without mention of open wound into cavity"/>
      <Diagnosis Icd="760.70" Name="Unspecified noxious substance affecting fetus or newborn via placenta or breast milk"/>
    </Diagnoses>
    <Procedures>
      <Procedure Cpt="66930" Name="REMOVAL OF LENS MATERIAL; INTRACAPSULAR, FOR DISLOCATED LENS"/>
      <Procedure Cpt="86.27 " Name=" 86.27 "/>
      <Procedure Cpt="82540 " Name=" 82540 "/>
      <Procedure Cpt="96401 " Name=" 96401 "/>
    </Procedures>
    <Medications>
      <Medication AUI="1507592" CUI="1250188" Name="docosahexaenoic acid 310 MG"/>
    </Medications>
    <VisualAcuities>
      <VisualAcuity Laterality="Right" LogMar="0.7" Scale="Non-Numeric" SnellenValue="100"/>
    </VisualAcuities>
    <Injuries>
      <Injury Cause="Cause" Id="46792" Laterality="Right"/>
    </Injuries>
  </Encounter>
  <Encounter Id="48559" VisitDate="2006-12-25T19:53:45.9651413">
    <Referral Date="2012-01-24T21:52:24.2844466" Id="169313"/>
    <Patient Id="124331">
      <FirstName>Patient</FirstName>
      <LastName>5644425</LastName>
      <MaritalStatus>Not Married</MaritalStatus>
    </Patient>
    <Diagnoses>
      <Diagnosis Icd="662.10" Name="Unspecified prolonged labor, unspecified as to episode of care or not applicable"/>
      <Diagnosis Icd="815.03" Name="Closed fracture of shaft of metacarpal bone(s)"/>
      <Diagnosis Icd="763.82" Name="Abnormality in fetal heart rate or rhythm during labor"/>
      <Diagnosis Icd="795.13" Name="Papanicolaou smear of vagina with low grade squamous intraepithelial lesion (LGSIL)"/>
    </Diagnoses>
    <Procedures>
      <Procedure Cpt="89.52 " Name=" 89.52 "/>
      <Procedure Cpt="96413 " Name=" 96413 "/>
      <Procedure Cpt="08.89 " Name=" 08.89 "/>
      <Procedure Cpt="92070 " Name=" 92070 "/>
    </Procedures>
    <Medications>
      <Medication AUI="2526538" CUI="17128" Name="Levonorgestrel 0.000833 MG/HR [Mirena]"/>
    </Medications>
    <VisualAcuities>
      <VisualAcuity Laterality="Not Specified" LogMar="0.2" Scale="US" SnellenValue="32"/>
    </VisualAcuities>
    <Injuries>
      <Injury Cause="14" Id="44973" Laterality="Right"/>
    </Injuries>
  </Encounter>
  <Encounter Id="48560" VisitDate="2009-09-23T20:05:34.1440806">
    <Referral Date="2012-01-24T21:52:24.2844466" Id="169313"/>
    <Patient Id="124331">
      <FirstName>Patient</FirstName>
      <LastName>5644425</LastName>
      <MaritalStatus>Not Married</MaritalStatus>
    </Patient>
    <Diagnoses>
      <Diagnosis Icd="E892" Name="Conflagration not in building or structure"/>
      <Diagnosis Icd="V13.9" Name="Personal history of unspecified disease"/>
      <Diagnosis Icd="E854.3" Name="Accidental poisoning by central nervous system stimulants"/>
      <Diagnosis Icd="V89.03" Name="Suspected fetal anomaly not found"/>
      <Diagnosis Icd="E007.7" Name="Activities involving volleyball (beach) (court)"/>
    </Diagnoses>
    <Procedures>
      <Procedure Cpt="85027 " Name=" 85027 "/>
      <Procedure Cpt="97533 " Name=" 97533 "/>
      <Procedure Cpt="92060 " Name=" 92060 "/>
      <Procedure Cpt="67345" Name="Chemodenervation of extraocular muscle"/>
    </Procedures>
    <Medications>
      <Medication AUI="2627513" CUI="151790" Name="Buprenorphine 2 MG"/>
    </Medications>
    <VisualAcuities>
      <VisualAcuity Laterality="Left" LogMar="1" Scale="Decimal" SnellenValue="200"/>
    </VisualAcuities>
    <Injuries>
      <Injury Cause="Mortar/Rocket/Artillery Shell" Id="46791" Laterality="Right"/>
    </Injuries>
  </Encounter>
  <Encounter Id="48561" VisitDate="2006-08-24T18:52:21.2348944">
    <Referral Date="2010-02-20T14:59:18.1364233" Id="169333"/>
    <Patient Id="126576">
      <FirstName>Patient</FirstName>
      <LastName>7834675</LastName>
      <MaritalStatus>Divorced</MaritalStatus>
    </Patient>
    <Diagnoses>
      <Diagnosis Icd="784.0" Name="Headache"/>
      <Diagnosis Icd="375.01" Name="Acute dacryoadenitis"/>
    </Diagnoses>
    <Procedures>
      <Procedure Cpt="92592 " Name=" 92592 "/>
      <Procedure Cpt="20605 " Name=" 20605 "/>
    </Procedures>
    <Medications>
      <Medication AUI="1506070" CUI="236462" Name="Magnesium Oxide 500 MG [Phillips' Cramp-free]"/>
    </Medications>
    <VisualAcuities>
      <VisualAcuity Laterality="Not Specified" LogMar="0.9" Scale="Jaeger" SnellenValue="159"/>
    </VisualAcuities>
    <Injuries>
      <Injury Cause="20" Id="45151" Laterality="Right"/>
    </Injuries>
  </Encounter>
  <Encounter Id="48562" VisitDate="2002-11-03T01:21:50.5839484">
    <Referral Date="2011-09-30T03:35:19.3197457" Id="170693"/>
    <Patient Id="127963">
      <FirstName>Patient</FirstName>
      <LastName>8329509</LastName>
      <MaritalStatus>Married</MaritalStatus>
    </Patient>
    <Diagnoses>
      <Diagnosis Icd="V61.22" Name="Counseling for perpetrator of spousal and partner abuse"/>
    </Diagnoses>
    <Procedures>
      <Procedure Cpt="67505 " Name=" alcohol "/>
      <Procedure Cpt="95834 " Name=" 95834 "/>
      <Procedure Cpt="76.76 " Name=" 76.76 "/>
    </Procedures>
    <Medications>
      <Medication AUI="2625207" CUI="314373" Name="Acetaminophen 21.7 MG/ML / Dextromethorphan Hydrobromide 1 MG/ML / doxylamine succinate 0.417 MG/ML [Nyquil Cold & Flu]"/>
    </Medications>
    <VisualAcuities>
      <VisualAcuity Laterality="Left" LogMar="-0.1" Scale="Non-Numeric" SnellenValue="16"/>
    </VisualAcuities>
    <Injuries>
      <Injury Cause="InjuryCause" Id="45246" Laterality="Right"/>
    </Injuries>
  </Encounter>
</Encounters>

1 个答案:

答案 0 :(得分:2)

在匹配的文档上指定提取路径将允许您将文档节点插入搜索响应中。

http://docs.marklogic.com/guide/search-dev/query-options#id_37692

或者,将Accept标头设置为multipart / mixed,您可以使用搜索限定文档并使用转换来提取内容:

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

也就是说,如果您在Java或Node.js环境中工作,使用这些客户端API可能更容易实现这些操作。

希望有帮助,