lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Woody" <>
Subject RE: Query question
Date Fri, 06 Feb 2004 14:27:25 GMT
Hi Erik,

Here is the IndexWriter with the Standard analyzer:
Class variable: IndexWriter writer;

writer = IndexWriter(indexDirectory, new StandardAnalyzer(), true); 

While looping over the ResultSet I call this method:

private void indexDoc(ResultSet rs) throws Exception {
        Document doc = new Document();
        doc.add(Field.UnIndexed("value", rs.getString("value")));
        doc.add(Field.UnIndexed("name", rs.getString("name")));



The "indexed" data is a concatenation of the Code and Desciptor(s)
fields that they want to search by. They are concatenated with a space.
Ex. Select col1 as value, col2 as name, col3 || ' ' || col2 || ' ' ||
col5 as indexed from tableName. Since there are many tables that are
similar in structure I wrote the queries like this so I could multi
thread the re indexing process on a frequent basis and use one generic

Here is my test search class:

public IndexSearchTest(String search, String index) throws Exception {
        String indexName = dirLucene + index +"/";
        System.out.println("Index Name " + indexName);

        IndexSearcher searcher = new
        Query query = QueryParser.parse(search.toUpperCase(), "content",
new StandardAnalyzer());
        Hits hits =;
        Document result;
        System.out.println("Begin Search Results");
        for (int i=0;i<hits.length();i++) {
            result = hits.doc(i);
            System.out.println("Key :" + result.get("value") + " Desc: "
+ result.get("name")) ;
        System.out.println("Finished Search: " +hits.length());

Thanks in advance,

-----Original Message-----
From: Erik Hatcher [] 
Sent: Thursday, February 05, 2004 6:34 PM
To: Lucene Users List
Subject: Re: Query question

On Feb 5, 2004, at 3:27 PM, Justin Woody wrote:
> If I search the index for "building" it comes back fine (2 records) or

> "builder" (1record), but if I search for "build*" I only receive one 
> record, in my example, the second record. The client would like all 3 
> records to come back. Is there a way I can make that happen? I've been

> trying different query types and syntax, but haven't been able to 
> succeed.

We need more details to know what is going on.  What analyzer are you 
using with indexing?

How are you building the query objects?   QueryParser?  Same Analyzer 
as with indexer?

(Succinct) code is the best :)


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

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

View raw message