Rob, just in case you missed it in the dialogue earlier, let me recommend to 
your attention the PerFieldAnalyserWrapper mentioned by someone else. This 
allows you to specify different analysers for different fields, but presents as 
a single analyser. So during indexing and searching to benefit from analyser 
and query parser, and can index and search all fields with the analyser - no 
problems therefore having fields which are not analysed.

For fields like Id we use our own version of keyword analyser which converts to 
lower case both on index and search but otherwise preserves the term entirely.

The only slight problem is it makes it harder to use tools like Luke which use 
the standard analyser by default.

Moray
-------------------------------------
Moray McConnachie
Director of IT    +44 1865 261 600
Oxford Analytica  http://www.oxan.com


----- Original Message -----
From: Rob Cecil [mailto:rob.ce...@gmail.com]
Sent: Tuesday, June 26, 2012 06:50 PM
To: lucene-net-user@lucene.apache.org <lucene-net-user@lucene.apache.org>
Subject: Disparity between API usage and Luke

If I run a query against my index using QueryParser to query a field:

                var query = _parser.Parse("Id:BAUER*");
                var topDocs = searcher.Search(query, 10);
                Assert.AreEqual(count, topDocs.TotalHits);

I get 0 for my TotalHits, yet in Luke, the same query phrase yields 15
results, what am I doing wrong? I use the StandardAnalyzer both to
create the index and to query.

The field is defined as:

new Field("Id", myObject.Id, Field.Store.YES, Field.Index.NOT_ANALYZED)

and is a string field. The result set back from Luke looks like (screencap):

http://screencast.com/t/NooMK2Rf

Thanks!

---------------------------------------------------------
Disclaimer 

This message and any attachments are confidential and/or privileged. If this 
has been sent to you in error, please do not use, retain or disclose them, and 
contact the sender as soon as possible.

Oxford Analytica Ltd
Registered in England: No. 1196703
5 Alfred Street, Oxford
United Kingdom, OX1 4EH
---------------------------------------------------------

Reply via email to