Note that there are some explanatory texts on larger screens.

plurals
  1. POlucene boolean query with TermQuery?
    primarykey
    data
    text
    <p>i got the following code:</p> <pre><code>Lucene.Net.Analysis.Analyzer analyzer = new Lucene.Net.Analysis.Standard.StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29); var mainQuery = new Lucene.Net.Search.BooleanQuery(); foreach (var str in fields) { var parser = new Lucene.Net.QueryParsers.QueryParser(Lucene.Net.Util.Version.LUCENE_29, str, analyzer); mainQuery.Add(parser.Parse(search +"*"), Lucene.Net.Search.BooleanClause.Occur.SHOULD); } Lucene.Net.Search.TopScoreDocCollector collector = Lucene.Net.Search.TopScoreDocCollector.create(21, true); searcher.Search(mainQuery, collector); hits = collector.TopDocs().scoreDocs; </code></pre> <p>and life was good. until i noticed, that i get results that are also <code>NotActive</code>. so i said to myself, ok , no problem, lets add another query to the mainQuery just after the for loop like so:</p> <pre><code>var parser2 = new Lucene.Net.QueryParsers.QueryParser(Lucene.Net.Util.Version.LUCENE_29, "StateProperties.IsActive", analyzer); mainQuery.Add(parser2.Parse("True"), Lucene.Net.Search.BooleanClause.Occur.MUST); </code></pre> <p>unfortunally, this does not work. anyone can point me to the right direction of doing this ? i have read about filters, and even managed to apply one, but then i lose the scores ( well, not really lose, but they are way off the original query ). i also read about <code>TermQueryWrapper</code>, but could not find how to implement that ( so i dont know if thats what i need, even due it seems to be the right direction ).</p> <p><strong>EDIT:</strong> i forgot to mention, all the fields in <code>fields</code> are ANALYZED, the <code>StateProperties.IsActive</code> is <code>NOT_ANALYZED</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload