Conversation
|
|
||
| if (q instanceof SpanQuery) { | ||
| return wrapBoost((SpanQuery) q, boost); | ||
| return wrapBoost(maskField((SpanQuery) q), boost); |
There was a problem hiding this comment.
I have some concerns about this code living in the SpanConverter. The SubQueryProvider was at least tangentially related to the main PR task and might(?) be easier to pipe config data to. Maybe we could promote this?
There was a problem hiding this comment.
Yeah, that's definitely cleaner. One way we could do that is send it a map of fields to mask. I do think it'll be hard to make this change later in the builder flow since we'd have to step through each child query of the result and reinstantiate each query class in turn.
| BooleanQuery.class); | ||
|
|
||
| assertQueryEquals(req("q", "author:\"^acco*\""), "spanPosRange(SpanMultiTermQueryWrapper(author:acco*), 0, 1)", SpanPositionRangeQuery.class); | ||
| assertQueryEquals(req("q", "author:\"^acco*\""), "acco | acco*", BooleanQuery.class); |
There was a problem hiding this comment.
Is this asserting that the query should be an unfielded boolean query?
There was a problem hiding this comment.
Yeah, I think this is probably an error. We might not be handling the combination of both ^ and * together properly. I'll look closer at it.
There was a problem hiding this comment.
The assertQueryEquals is removing the field. q.toString() actually returns "first_author:acco first_author:acco*"
| req("defType", "aqp", "aqp.constant_scoring", "author^1", "aqp.classic_scoring.modifier", "0.6", "q", | ||
| "=author:(^accomazzi kurtz)"), | ||
| "FunctionScoreQuery(first_author:foo, scored by boost(sum(float(cite_read_boost),const(0.6))))", | ||
| "FunctionScoreQuery(+ConstantScore(spanPosRange(spanOr([author:accomazzi,, SpanMultiTermQueryWrapper(author:accomazzi,*)]), 0, 1)) +ConstantScore(author:kurtz,), scored by boost(sum(float(cite_read_boost),const(0.6))))", |
There was a problem hiding this comment.
This assertion is not correct; we would expect to see no spanPosRange here.
There was a problem hiding this comment.
Since it's a multi-term query, I think we have to convert it to SpanMultiTermQuery, otherwise we wouldn't be able to enforce the order of the terms.
…in/bug/first-author-desugar
…in/bug/first-author-desugar
I added a quick wrapper around span queries to "mask" the field:
https://lucene.apache.org/core/9_2_0/queries/org/apache/lucene/queries/spans/FieldMaskingSpanQuery.html
This will get applied when author queries are getting turned into span queries.