chriseldredge / Lucene.Net.Linq

LINQ provider to run native queries on a Lucene.Net index
Other
151 stars 66 forks source link

Unable to search NumericField #98

Open flodpanter opened 8 years ago

flodpanter commented 8 years ago

I have a problem searching a property mapped as a NumericField. Property is nullable-int-column. Column name is "CVR".

Pseudocode:

I map my properties like this:

var map = new ClassMap<KreditorSearchEngineItem>(Version.LUCENE_30);

//key
map.Key(x => x.Id).NotAnalyzed();       
map.Property(x => x.CVR).AsNumericField();

This Query finds element with CVR=1234 no matter if CVR is mapped as numeric or default.

Query().Where(x => x.CVR == 1234);

This query cannot find element when CVR is mapped as numeric. Works if mapped as standard field.

var analyzer = new StandardAnalyzer(Net.Util.Version.LUCENE_30);
            var parser = new MultiFieldQueryParser(Version.LUCENE_30, new [] {"CVR"}, analyzer)
            {
                AllowLeadingWildcard = true,
                DefaultOperator = QueryParser.Operator.OR
            };

Any thoughts?