lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Omar Didi" <>
Subject RE: strange results using QueryFilter
Date Sat, 16 Apr 2005 01:05:01 GMT
Hi Erik,

here is a sample code that I hope is enough to find out what s wrong.


Query domainQuery = new TermQuery( new Term( domain, brandName ) );
Filter domainFilter = new QueryFilter( domainQuery );
int total_result = searchIndex.getHits( "content", "bank of america" ).length();
String[] _tlds = {"com","net","org",....};
	for ( String tld : _tlds )
		// count is always 0 but when I dont use domainQuery it has different values
		int count = searchIndex.getHits( "content", brandName + " tld:" + tld, domainFilter ).length();
// this is the getHits method 
public Hits getHits( String defaultField, String query )
			throws ParseException,
		Hits results = null;

		// set the query parser properties
		QueryParser queryParser = new QueryParser( defaultField, m_analyzer );
		queryParser.setOperator( QueryParser.DEFAULT_OPERATOR_AND );
		Query searchQuery = queryParser.parse( query );"parsed query is :  " + searchQuery.toString());"parsed query is :  " + searchQuery.toString(defaultField));
		// get the results
		results = searchQuery );
		return results;

-----Original Message-----
From: Erik Hatcher []
Sent: Friday, April 15, 2005 8:11 PM
Subject: Re: strange results using QueryFilter

On Apr 15, 2005, at 4:52 PM, Omar Didi wrote:

> Hi guys,
> I have to do a search where the user will enter a query and then i 
> have to get the hit's length for that term plus get the hit's length 
> for that term such that the url ends with com or net or ..... I used 
> QueryFilter, it works fine when the query is only one word but when 
> the query is "bank of america" it doesn t return anything.
> I am using QueryParser, I did the toString() on the query and it look 
> like this: +content:bank +content:america +urlendswith:com. when i run 
> the same query without queryfilter it works fine. any explanations 
> will be very helpfull.

Short and sweet code example would do wonders to help see the details.


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

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

View raw message