Yes I am using the contrib/xml-query-parser and added the analyzer code into the TermQuery building sections. Seems to work, auto create a SpanOrQuery multi-token for Span building. I assume that works, putting a SpanOrQuery into a SpanNearQuery. Lucene is an amazing piece of work.
----- Original Message ---- From: Chris Hostetter <[EMAIL PROTECTED]> To: solr-dev@lucene.apache.org; jason rutherglen <[EMAIL PROTECTED]> Sent: Monday, August 28, 2006 8:13:11 PM Subject: Re: Possible bug in copyField : It's coming from a custom XML query handler which is just a : serialization of a Query from a client. The Solr server should do the : analysis as it has the schema. This is all to support Span Queries. Ah .. i see, so you've got a custom request handler getting input which is an XML representation of a structured query (Booleans and Spans and what not) and you're converting that into a tree of Query objects in Solr. Are you using the contrib/xml-query-parser from the Lucene repository? I haven't looked at it in much detail since the initial design discussions, but as i recall (and a quick glace at the test cases seems to confirm this) when constructing your Parser, you can specify an Analyzer to use and it hands it down tothe individual QueryBuilders -- so you can use request.getSchema().getQueryAnalyzer() to get what you need for the parser (that Analyzer "does the right thing" for all of the fields and dynamic fields defind in your schema. if you are using your Own XML syntax/parser you can still use that analyzer when parsing the input (instead of walking the Query tree when you are done and re-parsing then) : : ----- Original Message ---- : From: Chris Hostetter <[EMAIL PROTECTED]> : To: solr-dev@lucene.apache.org; jason rutherglen <[EMAIL PROTECTED]> : Sent: Monday, August 28, 2006 6:29:29 PM : Subject: Re: Possible bug in copyField : : : : Thanks. Yes I came up with a hacked solution to the problem. Takes a : : Query and rewrites the Terms using the Analyzer. If the Analyzer : : typcially the Analisys happens before you construct a Query object -- : where are these Queries comping from that they are already objects but : haven't been analyzed? : : : returns more than one Token then those are ignored. Made Term.text : : public. Good enough for now, can be improved looks like QueryParser : : already does something like this, however I am confused what the rules : : are for adding multiple new Terms to a Query. : : it depends on wether the tokens occupy the same position. if multiple : sequential tokens are returned, it builds a phrase query, if multiple : parallel tokens are returned it builds BooleanQuery (using SHOULD) ... if : multiple tokens are reutrned and *some* of the tokens occupy the same : position, then a MultiPhraseQuery is constructed. : : : : : : ----- Original Message ---- : : From: Erik Hatcher <[EMAIL PROTECTED]> : : To: solr-dev@lucene.apache.org : : Sent: Monday, August 28, 2006 6:02:46 PM : : Subject: Re: Possible bug in copyField : : : : : : On Aug 28, 2006, at 3:37 PM, jason rutherglen wrote: : : : : > Could someone point me to where in the Solr code the Analyzer is : : > applied to a query parser field? : : : : IndexSchema.java is where the analyzers are created for indexing and : : for query parsing. It's fairly sophisticated in order to take into : : account all the various field settings from schema.xml. Hope that : : helps. : : : : Perhaps preaching to the choir... Be aware that changing an analyzer : : once documents are indexed does not change how they are indexed. : : They'll need to be re-added to pick up new analysis configuration. : : : : Erik : : : : : : : : : : : : : : : : : : -Hoss : : : : : : -Hoss