I'm having an issue with how I can go about achieving this and I was wondering if someone had any pointers...
My goal: To produce searches where AndQueries are ORed with a SpanNearQuery, therefore boosting the results higher because they appeared closer. The only use case I'm concerned with is the top of the query tree and if it's an AND, I want to expand it out so I have a spanNear also executing. For example: q=Tom Cruise Dancing would be come (Tom Cruise Dancing) OR SpanNear(Tom Cruise Dancing) Current setup: I have a standard QueryParser that I've added a 'PhraseExpansionProcessor' to the very beginning of the pipeline. This initially breaks a root AndQueryNode into an OrQueryNode((AndQueryNode(Terms...)), (SpanNearQueryNode(Terms...))). The SpanNearQueryNode is a class I made that implements FieldableNode and extends QueryNodeImpl (as I want all Fieldable children to be from the same field, therefore just remembering the terms). Plus it maintains a distance or slop factor and a inOrder boolean. The problem here is that I can't keep the children from getting manipulated further down the pipeline, because I want my NearSpanQueryBuilder to use it's original children nodes and at the same time be cloned/changed/etc. QueryNodeImpl has many private and final methods and you can't override setChildren, etc, etc., but I'd rather stay away from monkey patching. I thought about adding another array, "terms", that would maintain the original children array, but that also experiences quite a few inconveniences and conflicts with monkey patching. Any ideas? Any help would be much appreciated. -- View this message in context: http://lucene.472066.n3.nabble.com/AndQueryNode-to-NearSpanQuery-tp3061286p3061286.html Sent from the Solr - User mailing list archive at Nabble.com.