Eric, search:search will only return paths matching your searchable expression. You could pass //title as part of your $paths variable, or change your searchable expression: <searchable-expression>{concat($path,"|//title")}</searchable-expression>.
-Will From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Erik Zander Sent: Tuesday, June 19, 2012 8:40 AM To: general@developer.marklogic.com Subject: [MarkLogic Dev General] Search:Search result attribute path not returning full path on exact match Hi I have a problem with the search:search function and the result it gives me. The problem shows when I for example searches for the word Polikliniskt in the following structure <section> <title>Mätning av blodtryck</title> <section> <title>Polikliniskt</title> <para>Under normala fysiologiska förhållande föreligger stora variationer i blodtryck The resulting path attribute in the matches element in search result for Polikliniskt do not contains the title element only "//section/section". In other words the resulting path is "//section/section" instead of "//section/section/title" This behavior only occurs when the search term exactly matches the text within one element so if it's only one word i.e. title above or when quotes are used to indicate match exactly like "Mätning av blodtryck". The search options can be found below for even more information. param $searchString (string) The query string param $paths (???) return (xml) The result :) declare function medlib:getSearchResult($searchQueryString, $path) { let $options := <options xmlns="http://marklogic.com/appservices/search"> <searchable-expression>{$path}</searchable-expression> <search-option>score-logtfidf</search-option> <search-option>filtered</search-option> <page-length>10</page-length> (: <return-plan>true</return-plan>:) <term> <term-option>lang=sv</term-option> <term-option>wildcarded</term-option> <term-option>case-insensitive</term-option> <term-option>whitespace-insensitive</term-option> <term-option>punctuation-insensitive</term-option> <term-option>diacritic-sensitive</term-option> <empty apply="all-results"/> </term> <transform-results apply="snippet"> <per-match-tokens>100</per-match-tokens> <max-matches>2000</max-matches> <max-snippet-chars>40000</max-snippet-chars> <preferred-elements/> </transform-results> <debug>true</debug> </options> let $result := search:search($searchQueryString, $options) return $result Regards Erik Zander Developer @ Studentlitteratur AB
_______________________________________________ General mailing list General@developer.marklogic.com http://community.marklogic.com/mailman/listinfo/general