Marklogic Search on different values -
i working on search in marklogic , requirement bring result while searching "navin rawat" is:
o search should return n rawat o navin rawat o navin r o navin raw o navin rawat
i planning use search:search these results. but, not getting how these results different each other. body or suggest me how these result while using marklogic search:search or cts:search.
i think requirements this, you'll need code search expansion. build custom constraint search api it. string query,
expand:"navin rawat"
a structured query different convey same thing. next step actual expansion. it's not clear rules have in mind -- last name, number of starting letters, or there reason didn't include "navin ra"? i'll assume want number of letters.
you build function looks provide options last name:
declare function local:choices($first, $last) { $i in (1 fn:string-length($last)) return fn:substring($last, 1, $i) ! ($first || " " || .) }; local:choices("navin", "rawat")
=>
- navin r
- navin ra
- navin raw
- navin rawa
- navin rawat
with done, parse function return cts:word-query() sequence of strings. throw in "n rawat" case, , you're set.
Comments
Post a Comment