org.hibernate.search.exception.SearchException: HSEARCH000307: Sort type INT is not compatible with UNKNOWN type of field 'favoriteTerritory'.

Hibernate JIRA | Yoann Rodière | 7 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    When using custom numeric field bridges on a sortable field, querying with a sort on this field will always fail with the following stacktrace: {code} org.hibernate.search.exception.SearchException: HSEARCH000307: Sort type INT is not compatible with UNKNOWN type of field 'favoriteTerritory'. at org.hibernate.search.query.engine.impl.AbstractHSQuery.validateNumericEncodingType(AbstractHSQuery.java:430) at org.hibernate.search.query.engine.impl.AbstractHSQuery.validateNumericSortField(AbstractHSQuery.java:412) at org.hibernate.search.query.engine.impl.AbstractHSQuery.validateSortField(AbstractHSQuery.java:399) at org.hibernate.search.query.engine.impl.AbstractHSQuery.validateCommonSortField(AbstractHSQuery.java:307) at org.hibernate.search.query.engine.impl.AbstractHSQuery.validateSortField(AbstractHSQuery.java:283) at org.hibernate.search.query.engine.impl.AbstractHSQuery.validateSortFields(AbstractHSQuery.java:270) at org.hibernate.search.query.engine.impl.LuceneHSQuery.buildSearcher(LuceneHSQuery.java:481) at org.hibernate.search.query.engine.impl.LuceneHSQuery.buildSearcher(LuceneHSQuery.java:380) at org.hibernate.search.query.engine.impl.LuceneHSQuery.queryEntityInfos(LuceneHSQuery.java:138) at org.hibernate.search.query.hibernate.impl.FullTextQueryImpl.list(FullTextQueryImpl.java:202) at org.hibernate.search.test.query.sorting.SortOnFieldsFromCustomBridgeTest.testNumericCustomFieldLevelBridge(SortOnFieldsFromCustomBridgeTest.java:148) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.hibernate.testing.junit4.FailureExpectedHandler.evaluate(FailureExpectedHandler.java:41) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.hibernate.testing.junit4.BeforeClassCallbackHandler.evaluate(BeforeClassCallbackHandler.java:26) at org.hibernate.testing.junit4.AfterClassCallbackHandler.evaluate(AfterClassCallbackHandler.java:25) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) {code} Pull request coming, with test case and fix.

    Hibernate JIRA | 7 months ago | Yoann Rodière
    org.hibernate.search.exception.SearchException: HSEARCH000307: Sort type INT is not compatible with UNKNOWN type of field 'favoriteTerritory'.
  2. 0
  3. 0
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.search.exception.SearchException

      HSEARCH000307: Sort type INT is not compatible with UNKNOWN type of field 'favoriteTerritory'.

      at org.hibernate.search.query.engine.impl.AbstractHSQuery.validateNumericEncodingType()
    2. Hibernate Search Engine
      LuceneHSQuery.queryEntityInfos
      1. org.hibernate.search.query.engine.impl.AbstractHSQuery.validateNumericEncodingType(AbstractHSQuery.java:430)
      2. org.hibernate.search.query.engine.impl.AbstractHSQuery.validateNumericSortField(AbstractHSQuery.java:412)
      3. org.hibernate.search.query.engine.impl.AbstractHSQuery.validateSortField(AbstractHSQuery.java:399)
      4. org.hibernate.search.query.engine.impl.AbstractHSQuery.validateCommonSortField(AbstractHSQuery.java:307)
      5. org.hibernate.search.query.engine.impl.AbstractHSQuery.validateSortField(AbstractHSQuery.java:283)
      6. org.hibernate.search.query.engine.impl.AbstractHSQuery.validateSortFields(AbstractHSQuery.java:270)
      7. org.hibernate.search.query.engine.impl.LuceneHSQuery.buildSearcher(LuceneHSQuery.java:481)
      8. org.hibernate.search.query.engine.impl.LuceneHSQuery.buildSearcher(LuceneHSQuery.java:380)
      9. org.hibernate.search.query.engine.impl.LuceneHSQuery.queryEntityInfos(LuceneHSQuery.java:138)
      9 frames
    3. Hibernate Search ORM
      FullTextQueryImpl.list
      1. org.hibernate.search.query.hibernate.impl.FullTextQueryImpl.list(FullTextQueryImpl.java:202)
      1 frame
    4. org.hibernate.search
      SortOnFieldsFromCustomBridgeTest.testNumericCustomFieldLevelBridge
      1. org.hibernate.search.test.query.sorting.SortOnFieldsFromCustomBridgeTest.testNumericCustomFieldLevelBridge(SortOnFieldsFromCustomBridgeTest.java:148)
      1 frame
    5. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    6. JUnit
      FrameworkMethod.invokeExplosively
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      3 frames
    7. A Hibernate O/RM Module
      ExtendedFrameworkMethod.invokeExplosively
      1. org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45)
      1 frame
    8. JUnit
      RunAfters.evaluate
      1. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      2. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      3. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      3 frames
    9. A Hibernate O/RM Module
      FailureExpectedHandler.evaluate
      1. org.hibernate.testing.junit4.FailureExpectedHandler.evaluate(FailureExpectedHandler.java:41)
      1 frame
    10. JUnit
      ParentRunner$2.evaluate
      1. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      2. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      3. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      4. org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      5. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      6. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      7. org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      8. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      8 frames
    11. A Hibernate O/RM Module
      AfterClassCallbackHandler.evaluate
      1. org.hibernate.testing.junit4.BeforeClassCallbackHandler.evaluate(BeforeClassCallbackHandler.java:26)
      2. org.hibernate.testing.junit4.AfterClassCallbackHandler.evaluate(AfterClassCallbackHandler.java:25)
      2 frames
    12. JUnit
      ParentRunner.run
      1. org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      1 frame
    13. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
      1 frame
    14. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      5 frames