Hello there!
I'm currently developing a new kind of query via Elasticsearch (but this question is about the Lucene part). I have an issue when it comes to scoring. Here's what I did: I have a new kind of Query, called "CommutingQuantumQuery" (short: CQQuery). I also have two classes "CommutingQuantumWeight" (CQWeight) and "CommutingQuantumScorer" (CQScorer). In my CQQuery, there exists a logical formula, connecting several other queries (e.g. TermQueries). What I'm trying to do is the following: In my CQWeight object, I have a bunch of other Weight objects stored in an array "conditionWeights" which are also available in my CQScorer class. Now, I "just" want to get the scores from the respective query for some document. Thus, in CQScorer's score() method, I tried "conditionScores[i] = this.conditionWeights[i].scorer(this.context).score();" to retrieve a sub-Query's Weight's respective scorer, then let it compute its score and then return it to me (the LeafReaderContext "this.context" is taken from the parent Weight object). Although, when I try running this approach, the following error appears: "Cannot invoke "org.apache.lucene.search.Scorer.score()" because the return value of "org.apache.lucene.search.Weight.scorer(org.apache.lucene.index.LeafReaderCo ntext)" is null" I think there is something I missed to do to even produce some scores. Because when I output the score() values, they are always "0.0". I read that the "search()" method in IndexSearcher might be important, but I have no clue on when and how to use it in my context. Does anybody have an idea what I could try? Thank you so much already! Tim