Hi, I'm constructing a query where I want to search for members that are your friends (in a social network). And I'm not sure how construct the search that look for a member name which need to have an ID that is A or B or C.
I would do that in SQL like this: select *from members where username like '%rob%' and ID in(select Id from friends) The problem: The problem is that the query must match ALL ids. I want it to match ANY id. My code: String[] fields = searchQuery.Split(' '); QueryParser qp = new QueryParser("DisplayName", new StandardAnalyzer()); BooleanQuery query = new BooleanQuery(); foreach (string s in fields) { query.Add(qp.Parse(s), BooleanClause.Occur.SHOULD); } if(memberIds != null) // List<int> with friend id's { foreach (int id in memberIds) { QueryParser qp2 = new QueryParser("Id", new StandardAnalyzer()); Query q2 = qp2.Parse(id.ToString()); qp2.SetDefaultOperator(QueryParser.Operator.OR); BooleanClause bc = new BooleanClause(q2, BooleanClause.Occur.MUST); query.Add(bc); } Thanks, Rob