i have been troubleshooting a weird Solr4.2.1 querying behavior but with no success. i have schema that includes the below fields:
<field name="primaryIndustryName_en" type="text_general" indexed="true" stored="true" multiValued="false"/>
<field name="defaultSearchField" type="text_general" indexed="true" stored="false" multiValued="true"/>
defaultSearchField is the default field (df) for solr.SearchHandler /select requestHandler
the defaultSearchField contains data using copyField below
<copyField source="countryName_en" dest="defaultSearchField"/>
<copyField source="plsName_en" dest="defaultSearchField"/>
<copyField source="categoryName_en" dest="defaultSearchField"/>
<copyField source="primaryIndustryName_en" dest="defaultSearchField"/>
...etc
the text_general filed definition is as follows
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.TrimFilterFactory"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
<filter class="solr.WordDelimiterFilterFactory"
splitOnNumerics="1"
splitOnCaseChange="0"
stemEnglishPossessive="0"
generateWordParts="1"
generateNumberParts="1"
catenateWords="0"
catenateNumbers="0"
catenateAll="0"
preserveOriginal="1"
protected="protwords.txt"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<charFilter class="solr.HTMLStripCharFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.TrimFilterFactory"/>
<filter class="solr.WordDelimiterFilterFactory"
splitOnNumerics="1"
splitOnCaseChange="0"
stemEnglishPossessive="0"
generateWordParts="1"
generateNumberParts="1"
catenateWords="0"
catenateNumbers="0"
catenateAll="0"
preserveOriginal="1"
protected="protwords.txt"/>
<filter class="solr.HunspellStemFilterFactory"
dictionary="en_US.dic"
affix="en_US.aff"
ignoreCase="true" />
</analyzer>
</fieldType>
now if i search for restaurants & cafes AND countryId:1 i get the right documents (basically all the businesses that are "restaurants & cafes")
. But if i explicitly search for primaryIndustryName_en:"restaurants & cafes" AND countryId:1 i get an empty result list. the same behavior for upper and lowercase initiald. Note that i am using edismax parser and all queries are done via SolrJ
below is an document output
<doc>
<int name="brateCount">0</int>
<str name="outletPrimaryName">La Maison Du Cafe (Cafe Najjar)</str>
<str name="outletId">734</str>
<str name="outletPhone1">+961-1-346646</str>
<str name="outletUrl">www.lamaisonducafenajjar.com</str>
<double name="outletAvarageRating">0.0</double>
<str name="outletAddress">Hamra Main Street</str>
<int name="views">0</int>
<int name="areaId">1</int>
<str name="facetAreaName_en">Hamra</str>
<str name="areaName_en">Hamra</str>
<str name="areaName_ar">Hamra</str>
<str name="facetAreaName_ar">Hamra</str>
<str name="areaName_fr">Hamra</str>
<str name="facetAreaName_fr">Hamra</str>
<int name="cityId">1</int>
<str name="cityName_en">Beirut</str>
<str name="facetCityName_en">Beirut</str>
<str name="facetCityName_ar">Beirut</str>
<str name="cityName_ar">Beirut</str>
<str name="cityName_fr">Beirut</str>
<str name="facetCityName_fr">Beirut</str>
<int name="countryId">1</int>
<str name="countryCode">LB</str>
<str name="countryName_en">Lebanon</str>
<str name="countryName_ar">Lebanon</str>
<str name="countryName_fr">Lebanon</str>
<int name="primaryIndustryId">55</int>
<str name="primaryIndustryName_en">Restaurants & Cafes</str>
<str name="facetPrimaryIndustryName_en">Restaurants & Cafes</str>
<str name="primaryIndustryName_ar">Restaurants & Cafes</str>
<str name="facetPrimaryIndustryName_ar">Restaurants & Cafes</str>
<str name="primaryIndustryName_fr">Restaurants & Cafes</str>
<str name="facetPrimaryIndustryName_fr">Restaurants & Cafes</str>
<int name="primaryCategoryId">114</int>
<str name="primaryCategoryName_en">Coffee Shops</str>
<str name="facetPrimaryCategoryName_en">Coffee Shops</str>
<str name="facetPrimaryCategoryName_ar">Coffee Shops</str>
<str name="primaryCategoryName_ar">Coffee Shops</str>
<str name="primaryCategoryName_fr">Coffee Shops</str>
<str name="facetPrimaryCategoryName_fr">Coffee Shops</str>
<arr name="ratingId">
<int>10</int>
<int>11</int>
<int>12</int>
<int>13</int>
<int>15</int>
<int>9</int>
</arr>
<arr name="ratingName_en">
<str>Drinks</str>
<str>Service</str>
<str>Value</str>
<str>Atmosphere</str>
<str>Cleanliness</str>
<str>Food</str>
</arr>
<arr name="ratingName_ar">
<str>Drinks</str>
<str>Service</str>
<str>Value</str>
<str>Atmosphere</str>
<str>Cleanliness</str>
<str>Food</str>
</arr>
<arr name="ratingName_fr">
<str>Drinks</str>
<str>Service</str>
<str>Value</str>
<str>Atmosphere</str>
<str>Cleanliness</str>
<str>Food</str>
</arr>
<arr name="plsId">
<int>52</int>
<int>53</int>
<int>54</int>
<int>55</int>
<int>56</int>
<int>58</int>
<int>60</int>
<int>61</int>
<int>84</int>
<int>85</int>
<int>119</int>
</arr>
<arr name="plsName_en">
<str>Water</str>
<str>Juice</str>
<str>Soft Drink</str>
<str>Coffee</str>
<str>Tea</str>
<str>Smoothie</str>
<str>Hot Chocolate</str>
<str>Energy Drink</str>
<str>Salad</str>
<str>Sandwich</str>
<str>Dessert</str>
</arr>
<arr name="plsName_ar">
<str>Water</str>
<str>Juice</str>
<str>Soft Drink</str>
<str>Coffee</str>
<str>Tea</str>
<str>Smoothie</str>
<str>Hot Chocolate</str>
<str>Energy Drink</str>
<str>Salad</str>
<str>Sandwich</str>
<str>Dessert</str>
</arr>
<arr name="plsName_fr">
<str>Water</str>
<str>Juice</str>
<str>Soft Drink</str>
<str>Coffee</str>
<str>Tea</str>
<str>Smoothie</str>
<str>Hot Chocolate</str>
<str>Energy Drink</str>
<str>Salad</str>
<str>Sandwich</str>
<str>Dessert</str>
</arr>
<long name="_version_">1441614839971577856</long></doc>
any idea what might be the problem??
I tried with the same configuration you are using. The issue you are getting for the filter you added for text_general in query part.
<filter class="solr.HunspellStemFilterFactory"
dictionary="en_US.dic"
affix="en_US.aff"
ignoreCase="true" />
I removed the filter and it's working fine.
Related
The default behavior of this button is to be enabled always, and if a field is mandatory or incorrect, an error is shown.
But if you use the wizard, and you have to fill up different sections, it is not normal to submit the form if you are still at the beginning of the form. Probably you must navigate to all sections to fill up all questions (at least the mandatory ones) until you reach the last section. When you are in the last section, you can submit the form. At least, force the user to read all the form.
I know that is a little annoying this behaviour, specially with user with no so much experience with Orbeon, that are inclined to press this button when they have finished the first section.
Then the question is: there is any way of hide or disable the "send" button until the last section is reached?
EDIT
As shown in documentation page the new version 2016.1 of Orbeon finally hides the "submit" button. At least, this text is shown:
Wizard improvements. The wizard's table of contents indicates pages with errors more clearly. In validated mode, pages which cannot be navigated to are also indicated better. Last but not least, in validated mode, Save, Submit, Send, and other buttons which appear within the wizard only show when the user reaches the last page of the wizard. Finally, we made a few cosmetic improvements as well.
I am trying this new feature enabling validation mode, in the properties file:
<!-- Configure wizard layout -->
<property as="xs:string" name="oxf.fr.detail.view.appearance.*.*" value="wizard"/>
<property as="xs:boolean" name="oxf.xforms.xbl.fr.wizard.validate.*.*" value="true"/>
And I have created a simple form using the Form Builder:
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>Wizard Test</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<control-2/>
<control-3/>
</section-1>
<section-4>
<control-5/>
<control-6/>
</section-4>
<section-7>
<control-8/>
</section-7>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="control-2-bind" ref="control-2" name="control-2" required="true()"/>
<xf:bind id="control-3-bind" ref="control-3" name="control-3"/>
</xf:bind>
<xf:bind id="section-4-bind" ref="section-4" name="section-4">
<xf:bind id="control-5-bind" ref="control-5" name="control-5" required="true()"/>
<xf:bind id="control-6-bind" ref="control-6" name="control-6"/>
</xf:bind>
<xf:bind id="section-7-bind" ref="section-7" name="section-7">
<xf:bind id="control-8-bind" ref="control-8" name="control-8" type="xs:boolean"
required="true()"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>WizardTest</application-name>
<form-name>WizardTest</form-name>
<title xml:lang="en">Wizard Test</title>
<description xml:lang="en"/>
<singleton>false</singleton>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<control-8>
<label>Yes or no?</label>
<hint/>
</control-8>
<control-5>
<label>Radio Button Other</label>
<hint/>
<item>
<label>First choice</label>
<value>1</value>
<hint/>
</item>
<item>
<label>Second choice</label>
<value>2</value>
<hint/>
</item>
<item>
<label>Third choice</label>
<value>3</value>
<hint/>
</item>
</control-5>
<control-6>
<label>Select</label>
<hint/>
<item>
<label>First choice</label>
<value>1</value>
</item>
<item>
<label>Second choice</label>
<value>2</value>
</item>
<item>
<label>Third choice</label>
<value>3</value>
</item>
</control-6>
<control-2>
<label>Radio Button</label>
<hint/>
<item>
<label>First choice</label>
<value>1</value>
<hint/>
</item>
<item>
<label>Second choice</label>
<value>2</value>
<hint/>
</item>
<item>
<label>Third choice</label>
<value>3</value>
<hint/>
</item>
</control-2>
<control-3>
<label>Radio Button Other</label>
<hint/>
<item>
<label>First choice</label>
<value>1</value>
<hint/>
</item>
<item>
<label>Second choice</label>
<value>2</value>
<hint/>
</item>
<item>
<label>Third choice</label>
<value>3</value>
<hint/>
</item>
</control-3>
<section-1>
<label>Untitled Section</label>
</section-1>
<section-4>
<label>Section2</label>
<help/>
</section-4>
<section-7>
<label>Section3</label>
<help/>
</section-7>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<xf:select1 id="control-2-control" appearance="full" bind="control-2-bind">
<xf:label ref="$form-resources/control-2/label"/>
<xf:hint ref="$form-resources/control-2/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/control-2/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
<xf:hint ref="hint"/>
</xf:itemset>
</xf:select1>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<fr:open-select1 xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="control-3-control"
bind="control-3-bind">
<xf:label ref="$form-resources/control-3/label"/>
<xf:hint ref="$form-resources/control-3/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/control-3/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
<xf:hint ref="hint"/>
</xf:itemset>
</fr:open-select1>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
<fr:section id="section-4-control" bind="section-4-bind">
<xf:label ref="$form-resources/section-4/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:open-select1 xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="control-5-control"
bind="control-5-bind">
<xf:label ref="$form-resources/control-5/label"/>
<xf:hint ref="$form-resources/control-5/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/control-5/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
<xf:hint ref="hint"/>
</xf:itemset>
</fr:open-select1>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<fr:box-select xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
id="control-6-control"
bind="control-6-bind">
<xf:label ref="$form-resources/control-6/label"/>
<xf:hint ref="$form-resources/control-6/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/control-6/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
</xf:itemset>
</fr:box-select>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
<fr:section id="section-7-control" bind="section-7-bind">
<xf:label ref="$form-resources/section-7/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:yesno-input xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="control-8-control"
bind="control-8-bind">
<xf:label ref="$form-resources/control-8/label"/>
<xf:hint ref="$form-resources/control-8/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:yesno-input>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
I expect then, that in this example, the submit button is hidden and only appears in the last section, when all the other sections are filled up. But I cannot see the submit button when I reach the end of the form.
I also have tried enabling only a set of buttons adding this line to the properties file:
<property as="xs:string" name="oxf.fr.detail.buttons.*.*" value="wizard-prev wizard-next submit"/>
But the "submit" button in this case is always visible.
Is there something I have skipped?
Yes, this would make a lot of sense. Unfortunately, as of this writing this isn't possible. However, on the bright side, this one of the "top RFE" for the product, so I think there is a good chance that it will be implemented "soon". If you'd like to be notified when there is something new for this, you can subscribe yourself to issue #940: Better way to control buttons visibility/readonlyness.
I am using Form Builder (version 4.9) to create a form containing a Repeated Grid.
I've also defined a Process button, in order to send the form's data to a Servlet (using the send() method).
My goal is to save the form data in a DB table.
I am able to receive the Form's data as XML in the servlet, but I noticed that a field having the same value in different iterations,
appears only once per value in the XML, having a 'for' attribute with multiple values (indicating the number of the value repetitions).
However, I haven't been able to find a way to match all fields of the same iteration (indicating one table row), so I am not able to store the data in the DB correctly.
For Example , when I post the following table
HEADERS : FIELD_B - FIELD_C -
ITER_1 : FIELD_B_1 - FIELD_C_1 -
ITER_2 : FIELD_B_2 - FIELD_C_2 -
ITER_2 : FIELD_B_3 - FIELD_C_1 -
I get the following XML
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<control for="e7d2bb4ac261e77159fc236e7fd922c3540756f8" name="section-1"
type="section">
<resources lang="en">
<label>Untitled Section</label>
</resources>
</control>
<control for="69ec5abdeb2df55c97bf5b1db46cce6bc841aed8" name="FIELD_A"
type="input">
<resources lang="en">
<label>FIELD_A</label>
<hint />
</resources>
<value>FIELD_A_V</value>
</control>
<control for="9749b7620379db1e8f86eeceaf52c60fa19484d2" name="FIELD_B"
type="input">
<resources lang="en">
<label>FIELD_B</label>
<hint />
</resources>
<value>FIELD_B_1</value>
</control>
<control
for="89761405fd9de1a147bdda4d2c9279062b806016 9fa491ba6b72e86919e8a02226e28572c7309311"
name="FIELD_C" type="input">
<resources lang="en">
<label>FIELD_C</label>
<hint />
</resources>
<value>FIELD_C_1</value>
</control>
<control for="9cf502968950de2af58236fe0aaaab2a4fa5ac6d" name="FIELD_B"
type="input">
<resources lang="en">
<label>FIELD_B</label>
<hint />
</resources>
<value>FIELD_B_2</value>
</control>
<control for="46337304c26fca5cf9d5e91cdf393e3d39c0fbde" name="FIELD_C"
type="input">
<resources lang="en">
<label>FIELD_C</label>
<hint />
</resources>
<value>FIELD_C_2</value>
</control>
<control for="1155463007588b06b3842c534ca678aa6f5cf665" name="FIELD_B"
type="input">
<resources lang="en">
<label>FIELD_B</label>
<hint />
</resources>
<value>FIELD_B_3</value>
</control>
</metadata>
As you can see, in iterations 1 and 3, FIELD_C contains the value FIELD_C_1.
When parsing the XML, I am not able to find the order of the values of that field. I end up with the incorrect table :
HEADERS : FIELD_B - FIELD_C -
ITER_1 : FIELD_B_1 - FIELD_C_1 -
ITER_2 : FIELD_B_2 - FIELD_C_1 -
ITER_2 : FIELD_B_3 - FIELD_C_2 -
The iterations 2 and 3 have wrong values in FIELD_C.
How can I find the correct order of the values for the repeated fields ?
I am looking for a solution that does not require manipulating the form definition outside form builder, since the forms will be created by the end user with no knowledge of XForms.
The submit button in properties-local.xml is :
<property
as="xs:string"
name="oxf.fr.detail.process.OrbeonFormsPortlet.*.*">
validate-all
then send(
property = "oxf.fr.detail.send.success",
uri = "http://localhost:8080/web/guest/testlang/-/oaed-form-requests/pop_up/{xxf:get-request-header('Orbeon-Liferay-User-Id')}",
content = "metadata",
prune = "false"
)
</property>
The complete form definition is (the form contains a field - FIELD_A - outside repeated grid which is irrelevant to the problem):
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:exf="http://www.exforms.org/exf/1-0">
<xh:head>
<xh:title>TestRepeat</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all">
<form>
<section-1>
<FIELD_A/>
<grid-3>
<grid-3-iteration>
<FIELD_B/>
<FIELD_C/>
</grid-3-iteration>
</grid-3>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="FIELD_A-bind" name="FIELD_A" ref="FIELD_A"/>
<xf:bind id="grid-3-bind" ref="grid-3" name="grid-3">
<xf:bind id="grid-3-iteration-bind" ref="grid-3-iteration" name="grid-3-iteration">
<xf:bind id="FIELD_B-bind" ref="FIELD_B" name="FIELD_B"/>
<xf:bind id="FIELD_C-bind" ref="FIELD_C" name="FIELD_C"/>
</xf:bind>
</xf:bind>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>OAED</application-name>
<form-name>TestRepeat</form-name>
<title xml:lang="en">TestRepeat</title>
<description xml:lang="en"/>
<singleton>false</singleton>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<!-- Don't make readonly by default in case a service modifies the resources -->
<xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<FIELD_B>
<label>FIELD_B</label>
<hint/>
</FIELD_B>
<FIELD_C>
<label>FIELD_C</label>
<hint/>
</FIELD_C>
<section-1>
<label>Untitled Section</label>
</section-1>
<FIELD_A>
<label>FIELD_A</label>
<hint/>
</FIELD_A>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
<xf:instance xxf:readonly="true" id="grid-3-template">
<grid-3-iteration>
<FIELD_B/>
<FIELD_C/>
</grid-3-iteration>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:xbl="http://www.w3.org/ns/xbl">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<xf:input id="FIELD_A-control" bind="FIELD_A-bind">
<xf:label ref="$form-resources/FIELD_A/label"/>
<xf:hint ref="$form-resources/FIELD_A/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td/>
</xh:tr>
</fr:grid>
<fr:grid id="grid-3-grid" bind="grid-3-bind" repeat="content" min="1"
template="instance('grid-3-template')">
<xh:tr>
<xh:td>
<xf:input id="FIELD_B-control" bind="FIELD_B-bind">
<xf:label ref="$form-resources/FIELD_B/label"/>
<xf:hint ref="$form-resources/FIELD_B/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td>
<xf:input id="FIELD_C-control" bind="FIELD_C-bind">
<xf:label ref="$form-resources/FIELD_C/label"/>
<xf:hint ref="$form-resources/FIELD_C/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
I do reproduce this, and this appears to be an oversight. Control data is grouped to optimize the output size, but I now see that that can cause problems!
I am not sure that it is possible to infer the order properly given the current structure. I added an issue about this.
I found a few questions related to my problem (Orbeon index of repeat in repeatable section, Orbeon relevant properties and Orbeon nested repeats), but I couldn't get any of them to work properly.
I define a repeatable section with a couple of questions inside and a some relevant rules. I also define some events to manage the visibility of the questions. The problem appears when I create several repeated groups. When I select one of the answers, the relevant rules and the events are launched for all the questions with the same xpath route.
So, my question is: Is there a way to manage the same events ans the same relevant rules for repeatable sections?. That is, could I define some kind of dynamic route based on the index of the section that the user is selecting at the moment and use it in the relevant rules and the events?
The complete code used for the example is below:
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
<xh:head>
<xh:meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<xh:title>Test_repeatable</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>Test_app</application-name>
<form-name>Test_repeatable_v1</form-name>
<title xml:lang="en">Test_repeatable</title>
<description xml:lang="en">Description of the form.</description>
<singleton>false</singleton>
</metadata>
</xf:instance>
<xf:instance id="fr-form-instance">
<form>
<Category>
<Group>
<Group-iterator>
<Question/>
<Question2/>
<Question3/>
</Group-iterator>
</Group>
</Category>
</form>
</xf:instance>
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="Category-bind" name="Category" ref="/form/Category">
<xf:bind id="Group-bind" name="Group" ref="/form/Category/Group">
<xf:bind id="Group-iterator-bind" name="Group-iterator"
ref="/form/Category/Group/Group-iterator">
<xf:bind id="Question-bind" name="Question" ref="Question" required="true()"/>
<xf:bind id="Question2-bind"
name="Question2"
readonly="false"
ref="Question2"
relevant="/form/Category/Group/Group-iterator/Question='Answer'"
required="true()"/>
<xf:bind id="Question3-bind"
name="Question3"
readonly="false"
ref="Question3"
relevant="/form/Category/Group/Group-iterator/Question='Answer2' or instance('visible')/Group/Group-iterator/Question2 != 'false' "
required="true()"/>
</xf:bind>
</xf:bind>
</xf:bind>
</xf:bind>
<xf:instance id="fr-form-attachments">
<attachments>
<css filename="" mediatype="text/css" size=""/>
<pdf filename="" mediatype="application/pdf" size=""/>
</attachments>
</xf:instance>
<xf:instance id="fr-form-resources" xxf:readonly="false">
<resources>
<resource xml:lang="en">
<Category>
<label>Category</label>
<hint/>
<alert/>
<Group>
<label>Group</label>
<hint/>
<alert/>
<Question>
<label>Question</label>
<hint/>
<alert/>
<item>
<label>Answer</label>
<hint/>
<value>Answer</value>
</item>
<item>
<label>Answer2</label>
<hint/>
<value>Answer2</value>
</item>
</Question>
<Question2>
<label>Question2</label>
<hint/>
<alert/>
</Question2>
<Question3>
<label>Question3</label>
<hint/>
<alert/>
</Question3>
</Group>
</Category>
</resource>
</resources>
</xf:instance>
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
<xf:instance xxf:readonly="true" id="Group-template">
<Group-iterator>
<Question/>
<Question2/>
<Question3/>
</Group-iterator>
</xf:instance>
<!-- Keep track of visible/hidden status -->
<xf:instance id="visible">
<visible>
<Category>0</Category>
<Group>
<Group-iterator>
<Question>false</Question>
<Question2>false</Question2>
<Question3>false</Question3>
</Group-iterator>
</Group>
</visible>
</xf:instance>
<!-- Change the visibility status for 'Question'. -->
<xf:setvalue ev:event="xforms-enabled" observer="Question-control"
ref="instance('visible')/Group/Group-iterator/Question"
value="'true'"/>
<xf:setvalue ev:event="xforms-disabled" observer="Question-control"
ref="instance('visible')/Group/Group-iterator/Question"
value="'false'"/>
<!-- Update category showed elements count for 'Question'. -->
<xf:setvalue ev:event="xforms-enabled" observer="Question-control"
ref="instance('visible')/Category"
value="instance('visible')/Category + 1"/>
<xf:setvalue ev:event="xforms-disabled" observer="Question-control"
ref="instance('visible')/Category"
value="instance('visible')/Category - 1"/>
<!-- Change the visibility status for 'Question2'. -->
<xf:setvalue ev:event="xforms-enabled" observer="Question2-control"
ref="instance('visible')/Group/Group-iterator/Question2"
value="'true'"/>
<xf:setvalue ev:event="xforms-disabled" observer="Question2-control"
ref="instance('visible')/Group/Group-iterator/Question2"
value="'false'"/>
<!-- Update category showed elements count for 'Question2'. -->
<xf:setvalue ev:event="xforms-enabled" observer="Question2-control"
ref="instance('visible')/Category"
value="instance('visible')/Category + 1"/>
<xf:setvalue ev:event="xforms-disabled" observer="Question2-control"
ref="instance('visible')/Category"
value="instance('visible')/Category - 1"/>
<!-- Change the visibility status for 'Question3'. -->
<xf:setvalue ev:event="xforms-enabled" observer="Question3-control"
ref="instance('visible')/Group/Group-iterator/Question3"
value="'true'"/>
<xf:setvalue ev:event="xforms-disabled" observer="Question3-control"
ref="instance('visible')/Group/Group-iterator/Question3"
value="'false'"/>
<!-- Update category showed elements count for 'Question3'. -->
<xf:setvalue ev:event="xforms-enabled" observer="Question3-control"
ref="instance('visible')/Category"
value="instance('visible')/Category + 1"/>
<xf:setvalue ev:event="xforms-disabled" observer="Question3-control"
ref="instance('visible')/Category"
value="instance('visible')/Category - 1"/>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel">
<fr:section bind="Category-bind"
id="Category-control">
<xf:label mediatype="text/html"
ref="instance('fr-form-resources')/resource/Category/label"/>
<xf:hint ref="instance('fr-form-resources')/resource/Category/hint"/>
<xf:alert ref="instance('fr-form-resources')/resource/Category/alert"/>
<fr:section bind="Group-bind"
id="Group-control"
max="100"
min="1"
repeat="content"
template="instance('Group-template')">
<xf:label mediatype="text/html"
ref="instance('fr-form-resources')/resource/Category/Group/label"/>
<xf:hint ref="instance('fr-form-resources')/resource/Category/Group/hint"/>
<xf:alert ref="instance('fr-form-resources')/resource/Category/Group/alert"/>
<xh:tr>
<xh:td>
<xf:select1 appearance="full" bind="Question-bind"
id="Question-control">
<xf:label mediatype="text/html"
ref="instance('fr-form-resources')/resource/Category/Group/Question/label"/>
<xf:hint ref="instance('fr-form-resources')/resource/Category/Group/Question/hint"/>
<xf:alert ref="instance('fr-form-resources')/resource/Category/Group/Question/alert"/>
<xf:itemset
ref="instance('fr-form-resources')/resource/Category/Group/Question/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
<xf:hint ref="hint"/>
</xf:itemset>
</xf:select1>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:input bind="Question2-bind"
id="Question2-control">
<xf:label mediatype="text/html"
ref="instance('fr-form-resources')/resource/Category/Group/Question2/label"/>
<xf:hint ref="instance('fr-form-resources')/resource/Category/Group/Question2/hint"/>
<xf:alert ref="instance('fr-form-resources')/resource/Category/Group/Question2/alert"/>
</xf:input>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:input bind="Question3-bind"
id="Question3-control">
<xf:label mediatype="text/html"
ref="instance('fr-form-resources')/resource/Category/Group/Question3/label"/>
<xf:hint ref="instance('fr-form-resources')/resource/Category/Group/Question3/hint"/>
<xf:alert ref="instance('fr-form-resources')/resource/Category/Group/Question3/alert"/>
</xf:input>
</xh:td>
</xh:tr>
</fr:section>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
EDIT: A little explanation of the code above.
This example has two sections, one normal and inside of it one repeatable.
Inside the repeatable section there are three questions. The first question has two answers. When I select the first answer the form runner must show the questions two and three. When the second answer is selected the runner must show only the third question. This works correctly if I only have one repeatable section.
The problem appears when I create a new repeatable section. If I select the answer one of the first question, the following questions are shown at the same time in both repeatable groups. The same when I select answer two.
So the question is: Is there a way to tell the Orbeon runner that it must apply the relevant rules only to the repeatable group where the event happens?
EDIT 2: Ok, your solution is working perfect in the case of 'Question2'.
The problem comes with Question 3. If you check the code for Question3 you can see that I try to access also another instance:
relevant="$Question='Answer2' or instance('visible')/Group/Group-iterator/Question2 != 'false' "
The 'visible' instance is not related with any control or bind, is only used for storing an internal value for the questions and is updated using xforms events, as you can see in the code below:
<xf:setvalue ev:event="xforms-enabled"
observer="Question2-control"
ref="instance('visible')/Group/Group-iterator/Question2"
value="'true'"/>
Thus, my new question is: Is there a way to store different values for different iterations of a repeatable section in a static instance and accessing them using a dynamic path (like in your first response with the $)?
If in the xf:bind for Question2 you want to refer to the value of Question in the same iteration, then just use $Question. In fact, as a rule of thumb, you can always refer to the value of another control gaga as $gaga, and trust that the right thing will happen. (At least it will in most cases.) So, your xf:bind for Question2 will become:
<xf:bind id="Question2-bind" name="Question2"
readonly="false" ref="Question2"
relevant="$Question='Answer'"
required="true()"/>
I have a form that is using repeatable sections. This works fine when using relative path to the nodes of the form. The problem is that I want to not force to have unique names in the nodes of the form. An example:
<form>
<section-personalData>
<age/>
</section-personalData>
<section-kids-personalData>
<section-kids-personalData-iterator>
<age/>
</section-kids-personalData-iterator>
</section-kids-personalData>
</form>
In this example, as element <age> is in a different level, is allowed to have the same name. Of course, for allowing it, when defining the <bind> part of the node, I need to specify the complete path of the node to avoid confusion.
<xf:bind id="age-bind" name="age" ref="/form/section-personalData/age" required="true()"/>
This is working correctly. The problem comes with the element that is inside the repeatable section.
<xf:bind id="age-1-bind" name="age-1" ref="/form/section-kids-personalData/section-kids-personalData-iterator/age" required="true()"/>
This almost work but I have found an unexpected behaviour. When you have more than one iteration and answer the age value, all iterations ALWAYS have the same answer (when you change one of them, ALL are changed). I have experimented this with Input Fields, Radio Buttons, ...
When using the Orbeon Builder, all elements must have a unique name. But we are interested in have the same name in both elements due to client restrictions.
I copy a complete example that can be executed in Orbeon to test the problem.
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
<xh:head>
<xh:meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<xh:title>Loop</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>WebForms</application-name>
<form-name>Loop_v1</form-name>
<title xml:lang="en">Loop</title>
<description xml:lang="en">Version: 1. Modification date: 2014-12-04 10:06:03. Publication date: 2014-12-04 10:52:43.</description>
</metadata>
</xf:instance>
<xf:instance id="fr-form-instance">
<form>
<Category1>
<Loop>
<Loop-iterator>
<Question/>
</Loop-iterator>
</Loop>
</Category1>
</form>
</xf:instance>
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="Category1-bind" name="Category1" ref="/form/Category1">
<xf:bind id="Loop-bind" name="Loop" ref="/form/Category1/Loop">
<xf:bind id="Loop-iterator-bind" name="Loop-iterator"
ref="/form/Category1/Loop/Loop-iterator">
<xf:bind id="Question-bind" name="Question"
ref="/form/Category1/Loop/Loop-iterator/Question"
required="true()"/>
</xf:bind>
</xf:bind>
</xf:bind>
</xf:bind>
<xf:instance id="fr-form-attachments">
<attachments>
<css filename="" mediatype="text/css" size=""/>
<pdf filename="" mediatype="application/pdf" size=""/>
</attachments>
</xf:instance>
<xf:instance id="fr-form-resources" xxf:readonly="false">
<resources>
<resource xml:lang="en">
<Category1>
<label>Category1</label>
<hint/>
<alert/>
<Loop>
<label>Loop</label>
<hint/>
<alert/>
<Question>
<label>Question</label>
<hint/>
<alert/>
<item>
<label>Answer</label>
<hint/>
<value>Answer</value>
</item>
<item>
<label>Answer2</label>
<hint/>
<value>Answer2</value>
</item>
<item>
<label>Answer3</label>
<hint/>
<value>Answer3</value>
</item>
</Question>
</Loop>
</Category1>
</resource>
</resources>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
<xf:instance xxf:readonly="true" id="Loop-template">
<Loop-iterator>
<Question/>
</Loop-iterator>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel">
<fr:section bind="Category1-bind" id="Category1-control">
<xf:label mediatype="text/html" ref="$form-resources/Category1/label"/>
<xf:hint ref="$form-resources/Category1/hint"/>
<xf:alert ref="$form-resources/Category1/alert"/>
<fr:section bind="Loop-bind" id="Loop-control" max="100" min="1" repeat="true"
template="instance('Loop-template')">
<xf:label mediatype="text/html" ref="$form-resources/Category1/Loop/label"/>
<xf:hint ref="$form-resources/Category1/Loop/hint"/>
<xf:alert ref="$form-resources/Category1/Loop/alert"/>
<xh:tr>
<xh:td>
<xf:select1 appearance="full" bind="Question-bind" id="Question-control">
<xf:label mediatype="text/html" ref="$form-resources/Category1/Loop/Question/label"/>
<xf:hint ref="$form-resources/Category1/Loop/Question/hint"/>
<xf:alert ref="$form-resources/Category1/Loop/Question/alert"/>
<xf:itemset ref="$form-resources/Category1/Loop/Question/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
<xf:hint ref="hint"/>
</xf:itemset>
</xf:select1>
</xh:td>
</xh:tr>
</fr:section>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
In this example it is impossible to have different values for any repeated value of Question.
I really need to have the same name for both nodes, then I think that using a complete xpath is the solution. Therefore question is: how I can use a complete path for an element that is inside of a repeatable section? For any other case the complete xpath works correctly. (I am using Orbeon 4.7 at this moment).
I should start by saying that changing the data format to support the same name in multiple places is asking for trouble. Things will break in Form Builder if you do that, as it is currently a strong assumption. And things might break in Form Runner as well.
This said, for repeats, you have to use relative XPath expressions. I do not see a way around it. So instead of:
<xf:bind id="Category1-bind" name="Category1" ref="/form/Category1">
<xf:bind id="Loop-bind" name="Loop" ref="/form/Category1/Loop">
<xf:bind id="Loop-iterator-bind" name="Loop-iterator"
ref="/form/Category1/Loop/Loop-iterator">
<xf:bind id="Question-bind" name="Question"
ref="/form/Category1/Loop/Loop-iterator/Question"
required="true()"/>
</xf:bind>
</xf:bind>
</xf:bind>
Use:
<xf:bind id="Category1-bind" name="Category1" ref="Category1">
<xf:bind id="Loop-bind" name="Loop" ref="Loop">
<xf:bind id="Loop-iterator-bind" name="Loop-iterator"
ref="Loop-iterator">
<xf:bind id="Question-bind" name="Question"
ref="Question"
required="true()"/>
</xf:bind>
</xf:bind>
</xf:bind>
It doesn't follow that, by using the same name in different places, you need to use absolute paths. The binds can be referred to with variables, and can be relative too. You should have a hierarchical structure like this:
<xf:bind id="section-personalData-bind" name="section-personalData">
<xf:bind id="age-bind" name="age" ref="age" required="true()"/>
</xf:bind>
<xf:bind id="section-kids-personalData-bind" name="section-kids-personalData">
<xf:bind id="section-kids-personalData-iteration-bind" name="section-kids-personalData-iterator">
<xf:bind id="age-1-bind" name="age-1" ref="age" required="true()"/>
</xf:bind>
</xf:bind>
Referring to $age will find the first one, referring to $age-1 the second one.
World.
I'm new in rais. I have the problem:
After I use class for steamming
<filter class="solr.HunspellStemFilterFactory" dictionary="ru_RU.dic" affix="ru_RU.aff" ignoreCase="true" />
in "schema.xml"
<fieldType name="text" class="solr.TextField" indexed="true" stored="true" multiValued="true" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.LowerCaseFilterFactory"/>
<filter class="solr.HunspellStemFilterFactory" dictionary="ru_RU.dic" affix="ru_RU.aff" ignoreCase="true" />
<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="25" side="front" />
<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="25" side="back" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.LowerCaseFilterFactory"/>
<filter class="solr.HunspellStemFilterFactory" dictionary="ru_RU.dic" affix="ru_RU.aff" ignoreCase="true" />
</analyzer>
</fieldType>
I restart solr-server and then can't reindexing (rake sunspot:reindex). Get this error:
Errno::ECONNREFUSED: Connection refused - {:data=>"<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:Ad</query></delete>", :headers=>{"Content-Type"=>"text/xml"}, :method=>:post, :params=>{:wt=>:ruby}, :query=>"wt=ruby", :path=>"update", :uri=>#<URI::HTTP:0xa2a3280 URL:http://localhost:8982/solr/development/update?wt=ruby>, :open_timeout=>nil, :read_timeout=>nil, :retry_503=>nil, :retry_after_limit=>nil}
If I delete hunspell from schema.xml reindexing are completed.
ru_RU.dic and ru_RU.aff in utf-8.
Thank you in advance)