Thanks,
I put my field definition in $SEARCH-FIELD-MAP variable in lib-parser.xqy and
now when run this code:
...
let $query := lp:get-cts-query('pub:CADIZ gato')
return $query
I get
<results warning="non-element
node">cts:and-query((cts:element-word-query(xs:QName("DIARIO"), "CADIZ",
("lang=es"), 1), cts:word-query("gato", ("lang=es"), 1)), ())</results>
Where i can see expanded my search-field-map
However, my idea is to include this in lib-search search-criteria calling
lp:serialize-cts-query but then get this error
Code:
let $query := lp:get-cts-query('pub:CADIZ gato')
return lp:serialize-cts-query($query)
Result:
ERROR: eval-in Equis at file:c:/Xquerys/
XDMP-DUPATTR: element cts:element-word-query { attribute weight {
cts:element-word-query-weight($t) },
lp:serialize-QNames(cts:element-word-query-element-name($t)),
cts:element-word-query-text($t), for $o as item()* in
cts:element-word-query-options($t) return <cts:option>{ $o }</cts:option>,
attribute weight { cts:element-word-query-weight($t) } } -- Two attributes with
the same name
Stack trace:
in /lib-parser.xqy line 597:
lp:serialize-cts-queries((cts:element-word-query(xs:QName("DIARIO"), "CADIZ",
("lang=es"), 1), cts:word-query("gato", ("lang=es"), 1)))
$q := (cts:element-word-query(xs:QName("DIARIO"), "CADIZ", ("lang=es"), 1),
cts:word-query("gato", ("lang=es"), 1))
$t := cts:element-word-query(xs:QName("DIARIO"), "CADIZ", ("lang=es"), 1)
in /lib-parser.xqy line 546:
...
Mariano Grau
________________________________
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre de Frank Sanders
Enviado el: lunes, 14 de abril de 2008 21:50
Para: General Mark Logic Developer Discussion
Asunto: RE: [MarkLogic Dev General] RV: Problems with Fielded searchinlib-parser
Mariano,
It looks like you're on the right track, but your mixing the two libraries in a
way that's preventing you from getting your desired results. The config is good
for lib-search, but lib-parser doesn't know about it.
The easiest way to resolve this would be to look at the $SEARCH-FIELD-MAP
variable in lib-parser.xqy and put your field definition there. Then your call
should work as you expect it to.
Another option would be to create a search-criteria element as described in the
lib-search documentation, or by taking a look at params-to-query and its
related functions (build-query-element, construct-collection-criteria, and
construct-value-criteria come to mind) . Once you have a search-criteria
element constructed you can pass that to the build-cts-query function within
lib-search.
Hope this helps some.
-fs
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mariano Grau
Calín
Sent: Monday, April 14, 2008 5:33 AM
To: [email protected]
Subject: [MarkLogic Dev General] RV: Problems with Fielded search inlib-parser
Hello:
I'm trying to use fielded search and write in my config file this
<config xmlns="http://www.marklogic.com/ps/lib/lib-search/config"
xmlns:lp="http://www.marklogic.com/ps/lib/lib-parser">
<search>
<lp:search-field-map>
<lp:mapping code="pub"><DIARIO/></lp:mapping>
</lp:search-field-map>
</search>
</config>
If run in cq this code
import module namespace lp='http://www.marklogic.com/ps/lib/lib-parser' at
'lib-parser.xqy'
let $query := lp:get-cts-query('pub:CADIZ gato')
return lp:serialize-cts-query($query)
I get
- <cts:query xmlns:cts="http://marklogic.com/cts">
- <cts:word-query weight="1">
gato
<cts:option>lang=es</cts:option>
</cts:word-query>
</cts:query>
where field DIARIO (pub) not is found
I'm not sure if use the correct functions. I'm new in lib-search and lib-parser
and get to use features as date-field, sort and more, but fielded search not.
Sorry by my english
Mariano Grau
Dpto. Informática Grupo Joly
mgrau @ grupojoly.com
956 29 79 14
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general