Typically you would create an index of the data in Lucene when it is inserted, or via a batch process, and then use lucene to return primary keys on the search in order to retrieve the actual data.

In RDBMS terms, think of lucene as a full-text index on the various columsn you use, which also happens to index things much smarter =)

You don't store any real data in Lucene, you simply use it for text searches, and then use the information returned from the lucene lookup to find the real data.

Make any sense?

-Brian

On Jul 20, 2004, at 7:18 AM, Mike Young wrote:

On Tue, 20 Jul 2004 06:10:49 -0400, Brian McCallister wrote:

A slightly more complex, but considerably more powerful, search
solution is to use the Lucene indexing engine to handle search instead
of LIKE clauses. It requires building the indexes, but is very fast,
and very effective for searching -- much more so in my experience than
LIKE clauses.

-Brian

On Jul 20, 2004, at 5:29 AM, C.K, Shibin (Cognizant) wrote:


check this out. i got this from QueryByCriteria class

public Criteria buildCriteria (Object anExample) throws Exception{
Criteria criteria = new Criteria();
ClassDescriptor cld = MetadataManager.getInstance
().getRepository ().getDescriptorFor (anExample.getClass ());
FieldDescriptor [] fds = cld.getFieldDescriptions ();
PersistentField f;
Object value;


        for (int i = 0; i < fds.length; i++){
            f = fds [i].getPersistentField ();
            value = f.get (anExample);

            if (value != null){
                criteria.addEqualTo (f.getName (), value);
            }
        }

        return criteria;
    }


change the addEqualTo to addLike accordingly

shibin

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] Behalf Of Mike Young
Sent: Tuesday, July 20, 2004 2:50 PM
To: [EMAIL PROTECTED]
Subject: How to Develop a Search Page using QueryByCriteria


I am trying to develop a search page that allows users to input their search criteria into a form and after submitting this form the application will list all records that match the search criteria.

I currently have a form that captures the users input and places it
into a
bean. The bean is the same bean that i would use for gettting data from
the table (i.e. it has getters and setters for each column).


Where I need help is in writing a generic class that will build up the
search criteria using addLike for each property of the bean that is not
null without individually calling each of the getters and testing
whether
it is null or not before adding its value onto my criteria using
addlike.


Could anyone please point me in the right direction on how to acheive
this?

thanks in advance




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful.

  Visit us at http://www.cognizant.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


I have just had a very brief look at Lucene and guess that you might read
a whole table into an object using OJB and then search through the oject
using lucene. Doesn't this move all the processing from the database
server to the web server? As an Oracle DBA and applications developer this
kind of goes against the grain!


Are there any good quick starts that you can point me at so that I can
investigate this option?




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to