Hi, I have been playing around with the MoreLikeThis-query handler in Solr/Lucene. I am in a situation where I think that I can improve the quality of the LikeThis-documents significantly by restricting the MoreLikeThis-query to documents where one field has its term in a specified range. That is, I would like to add a RangeQuery to the default MoreLikeThis query.
The default behaviour of the MoreLikeThis-method in Lucene, is to construct the query by adding terms like: BooleanQuery query = new BooleanQuery(); tq = new TermQuery(new Term("field", "word"); query.add(tq, BooleanClause.Occur.SHOULD); I would like to also add a range restriction as, rq = new ConstantScoreRangeQuery("time",startTimeString,endTimeString,true,true); query.add(rq, BooleanClause.Occur.MUST); This is all made in contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java However, this does not work at all when running from Solr (no MLT suggestions are returned). I suspect that the problem is that the MoreLikeThisHandler in src/java/org/apache/solr/handler/MoreLikeThisHandler.java does not perform a standard query, but a getDocList: results.docList = searcher.getDocList(mltQuery, filters, null, start, rows, flags); and that this type of query does not handle a RangeQuery. Is this correct, or what is the problem with adding a RangeQuery? Should it be added in the "filters" part? How can I modify this in order to restrict the suggested documents to documents in the specified range? All hints are appreciated. /Clas Frisim.com