Raj Kumar wrote:
> hi dirk,
> I have written a BasicSearchQuery class which extends
> org.apache.slide.search.SearchQuery.
> It has a String toXML()
> method which creates a xml representation of the query in DASL format.I am
> attaching the BasicSearchQuery.java file.
> Please let me know if you think i need to make some changes to the class.
> thanks,
> rajkumar
First of all replace that enumeration to store the select properties. I saw the same
thing in
FindMethod, an enumeration has the disadvantage that you can only use it one time. (I'm
fixing FindMethod now)
Personally, I don't like all those constructors, or those convinience methods.
It makes evolving/changing the class feel like hell and most of the time you don't
need them
and the one time you need one... it's missing. No, just a setSearchOrder method and
one or
two contructors is good enough for me.
But that is just a personal way of doing things.
One thing I would remove is the BasicSearchScope class it doesn't really add any
functionality, does it ?
Your xml looks fine, only the namespace declaration is missing.
In a few hours/days I will commit the new PropertyName class and XMLPrinter, have a
look then
at FindMethod.
The most interesting piece of code will be the BasicSearchCondition class and
subclasses.
A BasicSearchQuery like this will be very usefull on the client side, we can just pass
it to
SearchMethod and it can generate the xml just by calling toXml() ... clean and simple
:-)
Regards
Dirk