Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
#193 Adding support for path fields
Browse files Browse the repository at this point in the history
  • Loading branch information
dmcassel committed Mar 25, 2014
1 parent d758edb commit 8e12546
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
23 changes: 19 additions & 4 deletions deploy/lib/xquery/setup.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -1308,9 +1308,8 @@ declare function setup:add-fields(
setup:add-fields-R(
setup:remove-existing-fields($admin-config, $database),
$database,
for $e in $db-config/db:fields/db:field[db:field-name != ""]
return
admin:database-field($e/db:field-name, $e/db:include-root))
$db-config/db:fields/db:field[db:field-name != ""]
)
};

declare function setup:add-fields-R(
Expand All @@ -1319,8 +1318,24 @@ declare function setup:add-fields-R(
$field-configs as element(db:field)*) as element(configuration)
{
if ($field-configs) then
let $field := $field-configs[1]
return
setup:add-fields-R(
admin:database-add-field($admin-config, $database, $field-configs[1]),
if ($field/db:field-path) then
admin:database-add-field(
$admin-config,
$database,
admin:database-path-field(
$field/db:field-name,
for $path in $field/db:field-path
return
admin:database-field-path($path/db:path, ($path/weight, 1.0)[1]))
)
else
admin:database-add-field(
$admin-config,
$database,
admin:database-field($field/db:field-name, $field/db:include-root)),
$database,
fn:subsequence($field-configs, 2))
else
Expand Down
15 changes: 15 additions & 0 deletions deploy/sample/ml-config.sample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,21 @@
-->
<!--
<fields>
<field>
<field-name></field-name>
<field-path>
<path>some/xpath</path>
<weight>1.0</weight>
</field-path>
<word-lexicons/>
<included-elements/>
<excluded-elements/>
<tokenizer-overrides/>
<stemmed-searches>basic</stemmed-searches>
<fast-phrase-searches>true</fast-phrase-searches>
<fast-case-sensitive-searches>true</fast-case-sensitive-searches>
<fast-diacritic-sensitive-searches>true</fast-diacritic-sensitive-searches>
</field>
<field>
<field-name/>
<include-root>true</include-root>
Expand Down

0 comments on commit 8e12546

Please sign in to comment.