lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Caroline Jen <jiapei_...@yahoo.com>
Subject findByProperty() in the scaffold.sql.AccessBase - Need Additional Parameters
Date Sun, 02 Nov 2003 01:57:08 GMT
Hi, I am new to Lucene.  I am studying the struts
example application in Ted Husted's book "Struts in
Action".  In his example, lucene is the searching
enging to look for articles that are stores in the
database.

Using the findByProperty() method, articles in the
database can be searched by
 
        Property             Value

         author             Victor Hugo or .....
         title              Les Miserables or .....
         content            whatever .....
         id                 168

However, the findByProperty method in the
org.apache.commons.scaffold.sql.AccessBase takes "only
one" pair of property/value as it parameters. As such,
visitors of the web site queries all articles in the
database; for example, by providing 'author' as the
property and supply the name of the author (xyz) as
value.

code:
----------------------------------------------------

public static final Collection findByProperty
(
        Object target,
        String property,
        String value
) throws ParameterException, PopulateException,
         ResourceException
{
         return SearchUtils.getCollection(target,
            Engine.getHits(
                Engine.getQuery(value,property)));

} // end findByProperty


I am stuck because I need to pass additonal parameters
rather than using only one pair of property/value of
parameters in the exising findByProperty() method --  
I have this field "category" in my database. I want to
search and get all the articles written by
author(property) with name xyz (value) within; say,
the HISTORY category. The value of the category will
be supplied by the application developer (NOT BY THE
VISITOR of the web site via selecting from a drop-down
list and fill out the value in the text field).
I need help in handling this kind of situation. Thanks
in advance.


__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

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


Mime
View raw message