lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anna Putnam" <a...@sendmemobile.com>
Subject QueryFilter usage
Date Wed, 16 May 2007 01:00:18 GMT
Hi all,

 

I am new to Lucene so I apologize if this is a really easy question.  I
am having trouble using the QueryFilter class.  

 

Basically, I want to narrow my search results, getting hits only for a
particular category.

 

This is what I've tried (getting no results)

 

String line ="justin";

Query query = parser.parse(line);

System.out.println("Query: " + query.toString());

Term t = new Term("category", "Pop");

TermQuery tq = new TermQuery(t);

QueryFilter qf = new QueryFilter(tq);

System.out.println("Filtered Query: " + fq.toString());

      

fq = new FilteredQuery(query, qf);

 

search(fq);

 

My debug gives the following:

 

Query: author:justin title:justin

Filtered Query: filtered(author:justin
title:justin)->QueryFilter(category:Pop)

 

If I call search(query) I get full results so I know "category" is
indexed.

 

Any help would be greatly appreciated.

 

-Anna

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message