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

Fix document suggestion on MongoDB

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.10-HF08, 8.2
    • Component/s: Core MongoDB, Tests

      Description

      The test ITDocumentRelationTest.testSimpleRelationBetweenTwoDocuments fails on MongoDB with:

      java.lang.IllegalArgumentException: More suggestions than expected for s2id_createForm:nxw_singleDocumentSuggestion_2_select2
      	at org.nuxeo.functionaltests.forms.Select2WidgetElement.selectValue(Select2WidgetElement.java:230)
      	at org.nuxeo.functionaltests.forms.Select2WidgetElement.selectValue(Select2WidgetElement.java:196)
      	at org.nuxeo.functionaltests.pages.tabs.RelationTabSubPage.setRelationWithDocument(RelationTabSubPage.java:134)
      	at org.nuxeo.ftest.cap.ITDocumentRelationTest.testSimpleRelationBetweenTwoDocuments(ITDocumentRelationTest.java:98)
      

      What happens is that at the step when we typed "Fil" then it does a search of ecm:fulltext LIKE 'fil%' (from page provider default_document_suggestion) which is translated in MongoDB as a query on

       { "$text" : { "$search" : "fil*" }} 
      

      However MongoDB text search doesn't understand prefix search, it only matches exact words (modulo stemming).

      So this search returns 0 result, but then on typing the next character we have "File" and this matches the fulltext. So the number of results increase while we type, which the test doesn't expect.

      As there is no way to do prefix-search on the fulltext for MongoDB, the simplest fix is to pass this page provider (default_document_suggestion, not to be confused with DEFAULT_DOCUMENT_SUGGESTION used by the suggestbox addon) to Elasticsearch.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h