Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-25751

Smart search generates bad NXQL expression when using a 'vocabulary' widget with entry ID contains comma

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 7.10, 8.10, 9.10, 10.2
    • Fix Version/s: None
    • Component/s: Smart Search
    • Tags:
    • Backlog priority:
      550

      Description

      When a Single vocabulary (or a Single directory suggestion) is used to select a value for a field in a smart search and when the vocabulary entry's ID contains a comma, a list of values is generated instead of a simple string value containing a comma.

      How to reproduce:

      • create a new vocabulary named ContentSpot:
      • add an entry with id set to 1,2 and label set to 1,2
      • create a new document type named Digital_File:
      • change its schema's prefix to dg
      • add a String field named ContentSpotDesc to it
      • under the creation layout, add a Single vocabulary widget for field dg:ContentSpotDesc with vocabulary ContentSpot
      • create a new XML extension with the following XML:
        <require>org.nuxeo.ecm.platform.smart.query.layouts</require>
        
        <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager" point="widgets">
        
          <widget name="nxql_smart_query_condition_contentspot_Splty"
            type="incremental_smart_query_condition">
            <labels>
              <label mode="any">Specialty Content Spot</label>
            </labels>
            <translated>true</translated>
            <properties widgetMode="edit">
              <property name="searchField">dg:ContentSpotDesc</property>
              <propertyList name="availableOperators">
                <value>IN</value>
              </propertyList>
            </properties>
            <subWidgets>
              <widget name="Splty_contentspot_select_multi"
                type="suggestManyDirectory">
                <fields>
                  <field>stringListValue</field>
                </fields>
                <widgetModes>
                  <!-- to show only when using 'IN' or 'NOT IN' -->
                  <mode value="any">
        
                    #{not empty value.conditionalOperator
                    and
                    value.conditionalOperator!='IN'
                    and
                    value.conditionalOperator!='NOT
                    IN'?'hidden':mode}
        
                  </mode>
                </widgetModes>
                <properties mode="any">
                  <property name="width">100%</property>
                  <property name="dbl10n">true</property>
                  <property name="minChars">0</property>
                  <property name="hideHelpLabel">true</property>
                  <property name="directoryName">ContentSpot</property>
                </properties>
              </widget>
              <widget name="splty_content_spot_text" type="text">
                <fields>
                  <field>stringValue</field>
                </fields>
                <widgetModes>
                  <!-- use in other cases -->
                  <mode value="any">
        
                    #{empty value.conditionalOperator
                    or
                    value.conditionalOperator=='IN'
                    or
                    value.conditionalOperator=='NOT
                    IN'
                    or value.conditionalOperator=='='
                    or
                    value.conditionalOperator=='!='?'hidden':mode}
                  </mode>
                </widgetModes>
              </widget>
            </subWidgets>
          </widget>
        
        </extension>
        
          <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager" point="layouts">
        
            <layout name="incremental_smart_query_selection">
              <templates>
                <template mode="any">
                  /layouts/incremental_smart_query_selection_layout_template.xhtml
                </template>
              </templates>
              <properties mode="any">
                <property name="hideNotOperator">true</property>
              </properties>
              <rows>
                <row name="nxql_smart_query_condition_fulltext">
                  <widget>nxql_smart_query_condition_fulltext</widget>
                </row>
                <row name="nxql_smart_query_condition_title">
                  <widget>nxql_smart_query_condition_title</widget>
                </row>
                <row name="nxql_smart_query_condition_contentspot_Splty">
                  <widget>nxql_smart_query_condition_contentspot_Splty</widget>
                </row>
                <row name="nxql_smart_query_condition_created">
                  <widget>nxql_smart_query_condition_created</widget>
                </row>
                <row name="nxql_smart_query_condition_contributors">
                  <widget>nxql_smart_query_condition_contributors</widget>
                </row>
                <row name="nxql_smart_query_condition_modified">
                  <widget>nxql_smart_query_condition_modified</widget>
                </row>
                <row name="nxql_smart_query_condition_expired">
                  <widget>nxql_smart_query_condition_expired</widget>
                </row>
                <row name="nxql_smart_query_condition_nature">
                  <widget>nxql_smart_query_condition_nature</widget>
                </row>
                <row name="nxql_smart_query_condition_subjects">
                  <widget>nxql_smart_query_condition_subjects</widget>
                </row>
                <row name="nxql_smart_query_condition_coverage">
                  <widget>nxql_smart_query_condition_coverage</widget>
                </row>
                <row name="nxql_smart_query_condition_description">
                  <widget>nxql_smart_query_condition_description</widget>
                </row>
                <row name="nxql_smart_query_condition_rights">
                  <widget>nxql_smart_query_condition_rights</widget>
                </row>
                <row name="nxql_smart_query_condition_source">
                  <widget>nxql_smart_query_condition_source</widget>
                </row>
                <row name="nxql_smart_query_condition_format">
                  <widget>nxql_smart_query_condition_format</widget>
                </row>
                <row name="nxql_smart_query_condition_language">
                  <widget>nxql_smart_query_condition_language</widget>
                </row>
                <row name="nxql_smart_query_condition_path">
                  <widget>nxql_smart_query_condition_path</widget>
                </row>
              </rows>
            </layout>
        
        </extension>
        
      • deploy
      • log in and create a new document of type Digital_File in a workspace:
      • select the only vocabulary entry 1,2 for field ContentSpotDesc
      • save document
      • navigate to main tab SEARCH and select Smart Search in top-left drop down
      • select field Specialty Content Spot in field selection drop down
      • select the only vocabulary entry 1,2 for its value
      • click Add button

      Expected result: dg:ContentSpotDesc IN ('1,2') is inserted in text area
      Actual result: dg:ContentSpotDesc IN ('1','2') is inserted in text area

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vdutat Vincent Dutat
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: