[MarkLogic Dev General] Attribute seach in Marklogic

Melkis.PenyameenSathakJebarathinam at cognizant.com Melkis.PenyameenSathakJebarathinam at cognizant.com
Wed Mar 11 05:49:05 PDT 2015


Hi All:

I am seeing a below problem in Search API.

Let's consider the below xml. We have title attribute (@title="Auto Test Assessment Update").

XML:

<?xml version="1.0" encoding="UTF-8"?>
<assessment title="Auto Test Assessment Update" identifier="00154ab3-167f-4b30-a53a-ecf633ff6bd2">
  <lastModifiedDate>2015-01-30T01:00:59.03454-05:00</lastModifiedDate>
  <created_by>Alex</created_by>
  <assessmentSection identifier="" title="Wrapper Section" assessmentSectionRefCount="1">
    <assessmentSectionRef identifier="463491ee-1f7d-433e-bd87-750121229dda"/>
  </assessmentSection>
</assessment>

Test-1:

Consider the below REST URL, I am retrieving the above xml which contain the word "Auto" in title attribute using the below search constraint and this works fine.

172.17.103.44:9000/v1/search?q=title:"Auto"&collection=Assessments&options=search-assessment&format=xml

<search:constraint name="title">
    <search:word>
      <search:attribute ns="" name="title"/>
      <search:element ns="" name="assessment"/>
    </search:word>
  </search:constraint>

Test-2:

I want to retrieve the same xml without constraint search (without constraint name in URL) as below.

172.17.103.44:9000/v1/search?q=Auto&collection=Assessments&options=search-assessment&format=xml

This doesn't retrieve the above xml because Marklogic will default create cts:word-query("Auto") and looks through only elements not attributes. So it fails.

For the below URL, Marklogic will default create cts:word-query("Ale"). The above xml is retrieved because we have "Alex" in "created_by" element(<created_by>Alex</created_by>)

172.17.103.44:9000/v1/search?q=Alex&collection=Assessments&options=search-assessment&format=xml

As we know attribute search is not part of Marklogic. Is there any solution to this problem?
Is there any option in Marklogic admin page (like attribute search scope) where I can configure to make attribute search work?

We don't have anything like cts:attribute-word-query() in Marklogic (to search through attributes) like we have cts:word-query (which does for element text content).

Warm regards,
Melkis Penyameen Sathak J
Associate - Projects
Advanced Solution Group
Cognizant Technology Solutions

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. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20150311/ffba5ce2/attachment.html 


More information about the General mailing list