java.lang.IllegalArgumentException: Invalid reference 'softId_suggest'

Stack Overflow | zhaosting | 2 months ago
  1. 0

    Get an exception with Invalid reference from Solr DocumentExpressionDictionaryFactory

    Stack Overflow | 2 months ago | zhaosting
    java.lang.IllegalArgumentException: Invalid reference 'softId_suggest'
  2. 0

    Mongo Shell working command. {code} db.person.aggregate( { $unwind: "$descriptors.carDescriptor.entries" }, {$project: {make: "$descriptors.carDescriptor.entries.make", model: "$descriptors.carDescriptor.entries.model", firstName:"$firstName", lastName: "$lastName"}}, {$group: {_id: "$make"}} ) {code} Equivalent Spring Data representation {code} Aggregation agg = Aggregation.newAggregation( unwind("descriptors.carDescriptor.entries"), project() .and("descriptors.carDescriptor.entries.make").as("make") .and("descriptors.carDescriptor.entries.model").as("model") .and("firstName").as("firstName") .and("lastName").as("lastName"), group("make") ); {code} While the Mongo Shell query work fine, Spring MongoTemplate form does not and returns the following error {noformat} java.lang.IllegalArgumentException: Invalid reference 'make'! at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:92) at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:62) at org.springframework.data.mongodb.core.aggregation.GroupOperation.toDBObject(GroupOperation.java:292) at org.springframework.data.mongodb.core.aggregation.Aggregation.toDbObject(Aggregation.java:247) at org.springframework.data.mongodb.core.MongoTemplate.aggregate(MongoTemplate.java:1323) at org.springframework.data.mongodb.core.MongoTemplate.aggregate(MongoTemplate.java:1306) at com.example.samples.MongoTemplateTest.testAggregation(MongoTemplateTest.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 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.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88) 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.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) {noformat} Pojo classes {code} // getter, setter omitted @Document public class Person { @Id private String id; private String firstName; private String lastName; private Descriptors descriptors; } public class Descriptors { private CarDescriptor carDescriptor; } public class CarDescriptor { private List<Entry> entries; class Entry { private String make; private String model; private int year; } } {code} To confirm if "make" is being returned remove the group("make") operator from the fluent api and the output shows that the make is indeed being returned. Any pointers / work arounds ? Thank you, Adil Fulara

    Spring JIRA | 3 years ago | Adil Fulara
    java.lang.IllegalArgumentException: Invalid reference 'make'!
  3. 0

    Hi I am using spring data mongodb 1.4.1.RELEASE version. query which i am trying with mongo shell is running fine db.users.aggregate({ $match : { '_id' : "8105846361" } },{$unwind:'$searchProfile.verticalProfiles'},{$group:{_id:'$searchProfile.verticalProfiles'}},{$sort:{'_id.ubsId':-1}}) { "result" : [ { "_id" : { "vertical" : "jobs", "ubsId" : "10208", "userSearchProfiles" : [ { "searchProfiles" : { "Location" : "Mombasa", "FunctionalArea" : "HR", "Experience" : "2", "Designation" : "Admin" }, "ulqId" : "10201" } ] } }, { "_id" : { "vertical" : "realestate", "ubsId" : "10206", "userSearchProfiles" : [ { "searchProfiles" : { "PropertyType" : "Independent House", "NoOfBedrooms" : "5", "PropertyFor" : "Buy", "Location" : "Mombasa" }, "ulqId" : "10200" } ] } } ], "ok" : 1 } But when i try the same with spring data mongo db using aggregation template Aggregation agg = Aggregation.newAggregation( Aggregation.match(Criteria.where("_id").is(msisdn)), Aggregation.unwind("searchProfile.verticalProfiles"), Aggregation.group("searchProfile.verticalProfiles"), Aggregation.sort(Sort.Direction.DESC,"_id.ubsId") ); it throws an error java.lang.IllegalArgumentException: Invalid reference '_id.ubsId'! at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:78) at org.springframework.data.mongodb.core.aggregation.SortOperation.toDBObject(SortOperation.java:70) at org.springframework.data.mongodb.core.aggregation.Aggregation.toDbObject(Aggregation.java:247) at org.springframework.data.mongodb.core.MongoTemplate.aggregate(MongoTemplate.java:1322) at org.springframework.data.mongodb.core.MongoTemplate.aggregate(MongoTemplate.java:1311) at in.verse.user.profile.repositories.impl.UserRepositoryImpl.sortByKey(UserRepositoryImpl.java:112) at in.verse.user.profile.service.test.UserRepositoryImplTest.save(UserRepositoryImplTest.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Please help me if somebody has faced the same issue and solved it

    Spring JIRA | 2 years ago | Rubi Hali
    java.lang.IllegalArgumentException: Invalid reference '_id.ubsId'!
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring Data MongoDB Aggregation framework, exception accessing computed value in group

    Stack Overflow | 3 years ago | DannyLane
    java.lang.IllegalArgumentException: Invalid reference 'duration'!
  6. 0

    I have the following mongodb document: {code:javascript} { "cmsParameterId":1, "examples":null, "rules":[ { "ruleType":"CODED", "values":[ "abc", "efg" ] }, { "ruleType":"SEQUENCE", "sequence":[ { "value":"a", "type":"CONSTANT" }, { "value":"2", "type":"PARAMETER" } ] } ] } {code} I use the following query in mongo shell which works fine. {code:javascript} db.domainknowledge.aggregate([ { $match: {cmsParameterId: { $in: [1] } } }, { $project: { cmsParameterId : 1 , rules : 1 }}, { $unwind: "$rules" }, { $group: { _id: { cmsParameterId: "$cmsParameterId", ruleType: "$rules.ruleType"}, total: { $sum: 1 } } } ]); {code} using spring-data I have written the following code to produce the same result but it ends up in an Exception: {code:java} Aggregation agg = newAggregation(match(Criteria.where("cmsParameterId").in(1)), project("cmsParameterId", "rules"), unwind("rules"), group("cmsParameterId", "rules.ruleType").count().as("totol")); AggregationResults<Summary> aggregate = mongoTemplate.aggregate(agg, "domainknowledge", Summary.class); {code} Here is the stacktrace of exception: {code:xml} java.lang.IllegalArgumentException: Invalid reference 'rules.ruleType'! at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:78) at org.springframework.data.mongodb.core.aggregation.ExposedFieldsAggregationOperationContext.getReference(ExposedFieldsAggregationOperationContext.java:62) at org.springframework.data.mongodb.core.aggregation.GroupOperation.toDBObject(GroupOperation.java:300) at org.springframework.data.mongodb.core.aggregation.Aggregation.toDbObject(Aggregation.java:247) at org.springframework.data.mongodb.core.MongoTemplate.aggregate(MongoTemplate.java:1405) at org.springframework.data.mongodb.core.MongoTemplate.aggregate(MongoTemplate.java:1346) at com.etilize.automation.dke.core.domainknowledge.report.DomainKnowledgeReportServiceImpl.generateCategoryWiseReport(DomainKnowledgeReportServiceImpl.java:57) {code}

    Spring JIRA | 3 years ago | Faisal Feroz
    java.lang.IllegalArgumentException: Invalid reference 'rules.ruleType'!

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Invalid reference 'softId_suggest'

      at org.apache.lucene.expressions.SimpleBindings.getValueSource()
    2. Lucene Expressions
      Expression.getValueSource
      1. org.apache.lucene.expressions.SimpleBindings.getValueSource(SimpleBindings.java:84)
      2. org.apache.lucene.expressions.ExpressionValueSource.<init>(ExpressionValueSource.java:45)
      3. org.apache.lucene.expressions.Expression.getValueSource(Expression.java:80)
      3 frames
    3. Apache Solr Core
      SolrCore.lambda$3
      1. org.apache.solr.spelling.suggest.DocumentExpressionDictionaryFactory.fromExpression(DocumentExpressionDictionaryFactory.java:107)
      2. org.apache.solr.spelling.suggest.DocumentExpressionDictionaryFactory.create(DocumentExpressionDictionaryFactory.java:92)
      3. org.apache.solr.spelling.suggest.SolrSuggester.build(SolrSuggester.java:174)
      4. org.apache.solr.handler.component.SuggestComponent$SuggesterListener.buildSuggesterIndex(SuggestComponent.java:528)
      5. org.apache.solr.handler.component.SuggestComponent$SuggesterListener.newSearcher(SuggestComponent.java:508)
      6. org.apache.solr.core.SolrCore.lambda$3(SolrCore.java:1863)
      6 frames
    4. Java RT
      FutureTask.run
      1. java.util.concurrent.FutureTask.run(Unknown Source)
      1 frame
    5. Apache Solr Solrj
      ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0
      1. org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:229)
      1 frame
    6. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      3. java.lang.Thread.run(Unknown Source)
      3 frames