Caroline Jen writes:

> I have a sample program that takes care of the search
> based on "one single pair of property and value" in
> the database.  For example, visitors of the web site
> can retrieve all articles written by Elizabeth Castro.
>  "creator" is the property and "Elizabeth Castro" is
> the value and they constitute one single pair of
> property and value.  The method signature of the
> search is:
> 
> findByProperty(this,property,value);

Is it? Which type of lucene object has such a method?
> 
> What is the method signature in Lucene if I want to
> search the database based on "two pairs of property
> and value"?  For example, I want to retrieve all
> articles written by Elizabeth Castro in the "computer
> science" category?
> 
> Am I on the right track?  Does my question make sense?
> 
I don't think so.

The method signature for a search in lucene is (in the easiest case)
hits = search(query)
where search is a method of a searcher object, and query is a query object.
Basically there are two ways to create a query object:
a) use the query parser
b) construct it yourself

Option a) allowes to formulate queries with the options described in
http://jakarta.apache.org/lucene/docs/queryparsersyntax.html.
For a single field a query might look like 'some term' with the
field defined as the default field.
To search other fields than the default field, you can use <fieldname>:term.
To combine subqueries you can use logical operators like AND, OR...
So a query might look like
creator:Castro AND category:computer

If you want to construct the query yourself you have to look at the
API docs and the different types of query subclasses.
E.g. you could combine two TermQuery objects with a BooleanQuery object.

HTH
Morus


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

Reply via email to