Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-2479

ConnectedMultiFieldsPhraseQueryBuilder uses HashMap on sorted map

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5.5.Final
    • Fix Version/s: 5.5.6.Final, 5.6.0.CR1, 5.7.0.Beta2
    • Component/s: engine
    • Labels:
      None
    • Environment:
      Linux, MySQL

      Description

      The ConnectedMultiFieldsPhraseQueryBuilder uses a HashMap to store Terms and positions (Line: 73). The Term query expects a List of sorted terms. Since a HashMap is not sorted in every case, the Phrase query may results in an error (Line 160). Consider using a TreeMap or order the Map before adding the Terms to the query.

      Exception: Caused by: java.lang.IllegalArgumentException: Positions must be added in order. Got position=2 while previous position was 16
      at org.apache.lucene.search.PhraseQuery.add(PhraseQuery.java:625)
      at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsPhraseQueryBuilder.createQuery(ConnectedMultiFieldsPhraseQueryBuilder.java:160)
      at org.hibernate.search.query.dsl.impl.ConnectedMultiFieldsPhraseQueryBuilder.createQuery(ConnectedMultiFieldsPhraseQueryBuilder.java:53)
      at com.andrae_ag.margay.search.Search.searchMemory(Search.java:57)
      at com.andrae_ag.margay.search.Search$$FastClassBySpringCGLIB$$7c5c7fd6.invoke(<generated>)
      at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
      ... 62 more

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: