lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [lucenenet] jregnier commented on issue #324: Exclude query help
Date Fri, 07 Aug 2020 20:23:19 GMT

jregnier commented on issue #324:

   thanks for the response, see below 
   `analyzer uses a chartokenizer with a lowercase filter
   var dir = FSDirectory.Open(indexFolderPath);
   var indexConfig = new IndexWriterConfig(LuceneVersion.LUCENE_48, {analyzer});
   _writer = new IndexWriter(dir, indexConfig);
   var parentDocument = new Document();
   var childDocument = new Document();
   childDocument.Add({TextField}) // not stored;
   childDocument.Add({StringField}) // only some documents will have this;
   // we are creating a parent child relationship with this list of documents
   _reader = DirectoryReader.Open(FSDirectory.Open(indexFolderPath));
   _searcher = new IndexSearcher(_reader);
   BooleanQuery.MaxClauseCount = int.MaxValue;
   var searchString = "value:test search string"
   var terms = new SpanMultiTermQueryWrapper(new WildcardQuery(new Term(fieldName, word))
// terms is a list of these for each word
   var childQuery = new SpanNearQuery(terms, 0, true)
   var parentFilter = new FixedBitSetCachingWrapperFilter(
      new QueryWrapperFilter(
         new TermQuery(
            new Term(fieldName, value))));
   var query = ToParentBlockJoinQuery(childQuery, parentFilter, ScoreMode.Max);
   var sort = new Sort(new SortField(null, SortFieldType.DOC));
   return _searcher.Search(query, _reader.NumDocs, sort)`

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.

For queries about this service, please contact Infrastructure at:

View raw message