lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Omar Didi" <od...@Cyveillance.com>
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.

thanks.

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,
			IOException
	{
		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 );
		logger.info("parsed query is :  " + searchQuery.toString());
		logger.info("parsed query is :  " + searchQuery.toString(defaultField));
		// get the results
		results = m_searcher.search( searchQuery );
		return results;
	}

-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
Sent: Friday, April 15, 2005 8:11 PM
To: java-user@lucene.apache.org
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.

	Erik


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


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