I have created a index as
Document doc = new Document();
doc.Add(new Field("SearchKey", (item.FullTextColumn ?? item.Code), Field.Store.NO, Field.Index.TOKENIZED));
doc.Add(new Field("Type", item.Type.ToString(), Field.Store.YES, Field.Index.TOKENIZED));
doc.Add(new Field("Name", item.Name, Field.Store.YES, Field.Index.UN_TOKENIZED));
doc.Add(new Field("Code", item.Code ?? string.Empty, Field.Store.YES, Field.Index.UN_TOKENIZED));
etc
and I am trying to search a term like "Kansas City" in "SearchKey" field and another filed "Type" must be "Airport"
for that I am writing
QueryParser parser = new QueryParser("SearchKey", analyzer);
Query searchQuery = parser.Parse(text);
TermQuery typeQuery = new TermQuery(new Term("Type", "Airport"));
BooleanQuery filterQuery = new BooleanQuery();
filterQuery.Add(typeQuery, BooleanClause.Occur.MUST);
Filter f = new QueryFilter(filterQuery);
Hits results = searcher.Search(searchQuery,f);
but it gives me NO result ,
if I remove 'f' from
Hits results = searcher.Search(searchQuery,f);
then it gives result but "Type" field contain values other then "Airport" .
any Idea where I am going wrong ?