lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Woody" <justin.wo...@comcast.net>
Subject RE: Query question
Date Fri, 06 Feb 2004 19:32:31 GMT
Hi Erik,

The analysis class is parsing the terms as expected. However, no partial
terms will return results. I've tried the following:
build
build*
"build"
"build*"

All return 0 hits unless the entire word (in this case build) appears.
I've tried this with multiple keywords. Any other ideas?
Thanks,
Justin

Looking forward to your book, there's not enough info out there for
Lucene.

-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com] 
Sent: Friday, February 06, 2004 11:42 AM
To: Lucene Users List
Subject: Re: Query question


Everything you are doing looks ok to me.  Next step is to run some 
sample text through something like the AnalyzerDemo.analyze method 
shown here:

	<http://today.java.net/pub/a/today/2003/07/30/LuceneIntro.html>

Be sure to use real world data, although "builder building" would be a 
good first pass to ensure all is working well then.  If you are really 
searching for "build*" using the code you've shown (without the 
quotes!) then it should work from my quick look at what you've done.

	Erik

On Feb 6, 2004, at 9:27 AM, Justin Woody wrote:

> 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")));
>
>         doc.add(Field.UnStored("content",rs.getString("indexed")));
>
>         writer.addDocument(doc);
>     }
>
> 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 class.
>
> 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 
> IndexSearcher(IndexReader.open(indexName));
>
>         Query query = QueryParser.parse(search.toUpperCase(),
> "content",
> new StandardAnalyzer());
>
>         Hits hits = searcher.search(query);
>         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,
> Justin
>
> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> 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 :)
>
> 	Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org


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


---------------------------------------------------------------------
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