lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ingemar Strandberg" <>
Subject Search using BooleanQuery with wildcards or phrases
Date Thu, 28 Jun 2007 12:33:41 GMT


I am trying to use a nested BooleanQuery using the query "+text:jennifer
lopez" and I get no hits. If I use a simple Query it works fine and I get
the results I want.


I am using Lucene.Net 2.0.004 and I have looked in the tests. I have not
found any tests on phrases or wildcards using BooleanQuery. Does anybody
know if this is a known issue. Does anybody have a solution or a hint what I
could do to solve this problem.


I would be very pleased if someone had a solution for this.




Here is the code if somebody is interested:


IndexReader reader = IndexReader.Open("c:\temp\myIndex");

IndexSearcher searcher = new IndexSearcher(reader);

Analyzer analyzer = new StandardAnalyzer();

QueryParser parser = new QueryParser("text", analyzer);

BooleanQuery q1 = new BooleanQuery();


q1.Add(new TermQuery(new Term("text", "The text I want to search for")),


if (m_CatList.Count > 0) // It doesn't matter whether it enters this area or


BooleanQuery q2 = new BooleanQuery();


for (int i = 0; i < m_CatList.Count; i++)


q2.Add(new TermQuery(new Term("category", m_CatList[i].ToString())),



q1.Add(q2, BooleanClause.Occur.MUST);



m_Hits = searcher.Search(q1, s);



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