In Luke you searched for a field named "contentlength", but in your C# code you searched for a field named "length". If this is not a typographical error in your post, this is the most likely the problem.
-- Neal -----Original Message----- From: Mark Cottman-Fields [mailto:mar...@qpac.com.au] Sent: Sunday, January 11, 2009 11:57 PM To: lucene-net-user@incubator.apache.org Subject: difference between Luke search and Lucene.Net search? Hi All I'm currently testing a lucene.net index for a website. The Luke search utility and my C# code give me different results for searches. There's probably a simple explanation, but I can't find it. The idea here is to check for changes using the url and the content length. C# code: (searcher is Lucene.Net.Search.IndexSearcher instance) public bool IsIndexed(Uri url, int stringcontent) { int foundCount = 0; Lucene.Net.Search.BooleanQuery bq = new Lucene.Net.Search.BooleanQuery(); bq.Add(new Lucene.Net.Search.TermQuery(new Lucene.Net.Index.Term("url", "\"" + url.AbsoluteUri + "\"")), Lucene.Net.Search.BooleanClause.Occur.MUST); bq.Add(new Lucene.Net.Search.TermQuery(new Lucene.Net.Index.Term("length", stringcontent.ToString())), Lucene.Net.Search.BooleanClause.Occur.MUST); Lucene.Net.Search.Hits hits = searcher.Search(bq); foundCount = hits.Length(); return foundCount > 0; } A search like: +url:"http://some.website.com/" +contentlength:1234 Finds exactly one item in Luke (the expected behaviour, if the url is indexed and has that length exactly), but returns nothing in my code above. They are both using the same index. Any ideas? BTW, great project, thank you! Mark ********** Disclaimer ********** This email, together with any attachments, is intended for the named recipient only. This email may contain information which is confidential, of a private nature or which is subject to legal professional privilege or copyright. Accordingly, any form of disclosure, modification, distribution and/or publication of this email message is prohibited unless expressly authorised by the sender acting with the authority of or on behalf of the Queensland Performing Arts Centre. If you have received this email by mistake, please inform the sender as soon as possible and delete the message and any copies of this message from your computer system network. The confidentiality, privacy or legal professional privilege attached to this email is not waived or destroyed by that mistake. Unless expressly attributed, the views expressed in this email do not necessarily represent the views of the Queensland Performing Arts Centre. ********************************