lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] jregnier commented on issue #296: IndexOutOfRangeException when searching
Date Wed, 17 Jun 2020 14:48:56 GMT

jregnier commented on issue #296:
URL: https://github.com/apache/lucenenet/issues/296#issuecomment-645421710


   Thanks for the quick response, I can't really supply the sample data since it could be
many things. The data is very diverse. Hopefully, the breakdown of my setup will be enough.
   
   `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();
   parentDocument.Add({BinaryDocValuesField});
   parentDocument.Add({StringField});
   parentDocument.Add({StringField});
   parentDocument.Add({StringField});
   
   var childDocument = new Document();
   childDocument.Add({StringField});
   childDocument.Add({StringField});
   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
   _writer.AddDocuments(documentList)
   
   _reader = DirectoryReader.Open(FSDirectory.Open(indexFolderPath));
   _searcher = new IndexSearcher(_reader);
   BooleanQuery.MaxClauseCount = int.MaxValue;
   
   var searchString = "value:*test search string*"
   var terms = new SpanMultiTermQueryWrapper<WildcardQuery>(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:
users@infra.apache.org



Mime
View raw message