Hi Team,
I am developing a search application. I have used a search API to
call search. I want to add additional tag called "Title" to all search:match.
The Title tag will hold the
value doc("/Book1.xml")/library/author[20]/book/AbstractText//*:title for each
matching results.
I tried by configuring the <search:snippet> with <extra> tag.But it
returns all the <title> tags present the document.But I need <title> tag of
particular match.
<transform-results apply="my-snippet" ns="http://test.com/search"
at="/Module/custom.xqy" />
custom.xqy
<search:snippet>
{
(
search:snippet($result, $ctsquery, $options)/*,
<extra>{$result//*:title}</extra>
)
}
</search:snippet>
Current search result:
<search:response
total="1"start="1"page-length="10"xmlns:search="http://marklogic.com/appservices/search">
- <search:result
index="1"uri="/Book1.xml"path="doc("/Book1.xml")/library/author[20]/"score="720"confidence="0.796986"fitness="0.93869">
- <search:snippet>
- <search:match path="doc("/Book1.xml")/library/author[20]//book/AbstractText">
The
<search:highlight>Tourist</search:highlight>
is a spy novel that begins on Sept. 10, 2001
</search:match>
- <search:match path="doc("/Book1.xml")/library/author[29]//book/Review">
The
<search:highlight>Tourist</search:highlight>
is a spy novel…
</search:match>
</search:snippet>
</search:result>
</search:response>
</search:response>
Expected Search result with the title tag.
<search:response
total="1"start="1"page-length="10"xmlns:search="http://marklogic.com/appservices/search">
- <search:result
index="1"uri="/Book1.xml"path="doc("/Book1.xml")/library/author[20]/"score="720"confidence="0.796986"fitness="0.93869">
- <search:snippet>
- <search:match path="doc("/Book1.xml")/library/author[20]//book/AbstractText">
The
<search:highlight>Tourist</search:highlight>
is a spy novel that begins on Sept. 10, 2001
</search:match>
<title>The Tourist</title>
- <search:match path="doc("/Book1.xml")/library/author[29]//book/Review">
The
<search:highlight>Tourist</search:highlight>
is a spy novel…
</search:match>
<title>The Author</title>
</search:snippet>
</search:result>
</search:response>
Regards,
Mano
The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
http://in.yahoo.com/_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general