diegolaz79 opened a new issue #629:
URL: https://github.com/apache/lucenenet/issues/629


   Hello, I'm doing a search first by text and then a second search with same 
text by adding some number filters:
   First search, results in a lot of results
   {+(username:*carlos* address:*carlos* country:*carlos* description:*carlos* 
notes:*carlos* ) }
   
   I then add a filter of userid = 1. 
   
   Tried first like a TextField:
   ```
    Query q = new TermQuery(new Term("userid", userid.Trim().ToLower()));
    booleanQuery.Add(q, Occur.MUST);
   resulting in
   {+(username:*carlos* address:*carlos* country:*carlos* description:*carlos* 
notes:*carlos* ) +usrid:1}
   ```
   
   Then like a number range
   ```
   int usrID = int.Parse(userid);
   Query q = NumericRangeQuery.NewInt32Range("userid", usrID, usrID, true, 
true);
   booleanQuery.Add(q, Occur.MUST);   
   resuing in
   {+(username:*carlos* address:*carlos* country:*carlos* description:*carlos* 
notes:*carlos* ) +usrid:[1 TO 1]}
   ```
   
   While indexing, these are the two approaches I took:
   ```
   new Int32Field("userid", (int)(userID != null ? userID : 0), 
Field.Store.YES),
   new TextField("userid",(userID != null ? userID.ToString() : ""), 
Field.Store.YES),
   ```
   
   And for analyer, I'm using 
   ```
   
   IDictionary<string, Analyzer> customAnalyzerPerField = new 
Dictionary<string, Analyzer>();
   customAnalyzerPerField ["userid"] = new 
StandardAnalyzer(LuceneVersion.LUCENE_48);
   // also tried customAnalyzerPerField ["userid"] = new 
WhitespaceAnalyzer(LuceneVersion.LUCENE_48);
   ```
   
   Any ideas on why its filtering to empty? (I checked DB and for that field 
there are a few rows that should match).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to