You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by bu...@apache.org on 2005/02/08 19:58:56 UTC

DO NOT REPLY [Bug 33449] New: - [PATCH] Introduction of QueryFactory interface for Query construction

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33449>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33449

           Summary: [PATCH] Introduction of QueryFactory interface for Query
                    construction
           Product: Lucene
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: QueryParser
        AssignedTo: lucene-dev@jakarta.apache.org
        ReportedBy: matt@codemonkeyconsultancy.net


To override the default behaviour of the QueryParser you must currently extend  
it and override the appropriate methods.  This seemed to be a little awkward.  
  
To enable a (hopefully) more flexible means of creating Query instances it  
would seem better to introduce a QueryFactory interface and pass an instance of  
an implementation of this interface to the QueryParser, having the QueryParser  
callback to it to construct the query as it parses it.  With this design you  
could write something like:  
  
QueryParser parser = new QueryParser("defaultField", new StandardAnalyzer(),  
new QueryFactoryImpl());  
  
Where 'QueryFactoryImpl' is an implementation of the QueryFactory interface.   
If you wanted to add the ability to lower case all of your queries you could  
then write:  
  
QueryParser parser = new QueryParser("defaultField", new StandardAnalyzer(),  
new LowerCaseQueryFactory(new QueryFactoryImpl()));  
  
Where 'LowerCaseQueryFactory' is a decorator around another QueryFactory  
instance and it simply lowercases all the terms passed to it before delegating  
the actual query construction.  This is a simple example, but more powerful  
functionality could be added not by changing the QueryParser, but by creating a  
new QueryFactory implementation. 
 
I have a patch for this which will be forthcoming in a moment.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org