lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason St. Louis" <>
Subject Question on how to build a query
Date Fri, 18 Jun 2004 23:11:10 GMT
Hi everyone.  I'm wondering if someone could help me out.

I have created an index of a database of person records where I have 
created documents with the following fields:
database primary_key (stored, not indexed)
first name (indexed)
last name (indexed)
city (indexed)

I used SimpleAnalyzer when creating the index.

I am providing a web based form to search this index.  The form has 3 
fields for first name, last name and city (city is a drop down list).

I want to take the users input and from these 3 fields and build a query 
such that:
A)last name is mandatory and can be wildcarded (I will probably make 
sure the value begins with at least one letter)
B)First name can be wildcarded (same as last name, although if it is 
left blank, I would probably just search the last_name and city and 
ignore the first name)
C)city is mandatory and must match exactly

How would I go about building this query?

Do I create a wildcard query for first name and last name, a term query 
for city and then combine them into boolean query where all 3 terms must 
be matched?  I kind of feel like I'm grasping at straws here.  I think I 
just need a jumpstart to understand how the Query API works.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message