lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Heinz Marbaise <khmarba...@gmx.de>
Subject Re: Problem with a "." for searching Lucene 2.4.0
Date Sat, 28 Nov 2009 21:39:47 GMT
Hi Ian,

many thanks for the hints...based on your and Ericks hints i have taken 
a deeper look into that...and the StandardAnalyzer which I'm using will 
removed informations like "." and "-" from my queries 
(+filename:testEXCEL-formats.xls) ...

> In addition to Erick's advice, since you are storing filename without
> analysis you could use a TermQuery to find it.
Does this mean i don't need to index the filename ?

 > You can use
> BooleanQuery to combine that with other queries, including those
> generated by QueryParser.
> 
Based on those advices i have made an implementation which modifies my 
CustomerQueryParser:

protected Query getFieldQuery(String field, String term) throws 
ParseException {
   LOGGER.debug("getFieldQuery(): field:" + field + " Term: " + term)
   if (FieldNames.REVISION.getValue().equals(field)) {
	int revision = Integer.parseInt(term);
	term = NumberUtils.pad(revision);
   }
		
   if (FieldNames.FILENAME.getValue().equals(field)) {
     Term t = new Term(FieldNames.FILENAME.getValue(), term.toLowerCase());
     TermQuery tq = new TermQuery (t);
     BooleanQuery bq = new BooleanQuery ();
     bq.add(tq, Occur.MUST);
     return bq;
   }
return super.getFieldQuery(field, term);
}

Based on my Unit Tests it works as expected...

But I'm not sure to understand the things like "queryparts 
-filename:*.xls" correct..

Doesn't that mean that my implementation will change the behaviour into 
the following:

"queryparts +filename:*.xls" or did i misunderstand things here ?


Thanks for your help...

Kind regards
Karl Heinz Marbaise
-- 
SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
Hauptstrasse 177                         USt.IdNr: DE191347579
52146 W├╝rselen                           http://www.soebes.de

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


Mime
View raw message