what you describe sounds almost like a new type of query that rewrites itself according to your custom rules (Query.rewrite takes in an INdexReader for this type of purpose) along with a customization of SolrQueryParser so you can look for your special field and use your custom query class in that case instead of a regular TermQuery.
: Date: Thu, 8 Feb 2007 13:07:56 -0500 : From: Brian Whitman <[EMAIL PROTECTED]> : Reply-To: [email protected] : To: [email protected] : Subject: Where to put in custom query rewriter? : : I have a custom Lucene module that when given a string, returns a : Lucene query. : It's quite like the MoreLikeThis query and performs a similar task : (returns the closest doc ids to the string), but you can only query : by string, not by doc id or anything. (I can't use MLT for reasons I : don't want to clutter up this post with) : : I'd like to put this in Solr. I was initially following the example : of the MLT patch (SOLR-61) but the MLT patch appears to work on a : list of results to generate more results. (e.g. you have to query : id:xxx first, and it adds to those results the ones like id:xxx.) : : I would rather this handler get installed as a "rewriter" e.g., Solr : gets a query like : : contents:kittens AND specialfield_X:"special query" : : and it sees the specialfield_ prefix, passes it to the Lucene query : rewriter module, which replaces it with something like (id:e1^0.9 OR : id:e2^0.5) : : And then Solr just does it usual thing with the result: : contents:kittens AND (id:e1^0.9 OR id:e2^0.5) : : Where should I put this in my hacked up fork of Solr? The one : requirement is that my Lucene rewriter needs to be instantiated with : an IndexReader object, just like the MLT query object. So it has to : be somewhere in Solr that knows about the IndexReader / : SolrQueryRequest / SolrIndexSearcher but hasn't done any query : parsing or searching yet. : : -Brian : : : : : : -Hoss
