Hi,-

i hope everyone is doing great.

 if i want to do the following search with PhraseWildCardQuery and thanks to this forum for letting me know about this class (Especially to David and Bruno)

term1 term2FirstChar*

i need to do two ways: (i found the source code at https://fossies.org/linux/lucene/sandbox/src/java/org/apache/lucene/search/PhraseWildcardQuery.java)

/*

maxMultiTermExpansions - The maximum number of expansions across all multi-terms and across all segments. It counts expansions for each segments individually, that allows optimizations per segment and unused expansions are credited to next segments. This is different from MultiPhraseQuery and SpanMultiTermQueryWrapper which have an expansion limit per multi-term.

segmentOptimizationEnabled - Whether to enable the segment optimization which consists in ignoring a segment for further analysis as soon as a term is not present inside it. This optimizes the query execution performance but changes the scoring. The result ranking is preserved.

*/


1st way:

PhraseWildCardQuery.Builder builder = PharseWildCardQuery.Builder(field, 2 _*/<<< i dont know what number to use here for maxMultiTermExpansions>>>/*_, true/*boolean segmentOptimizationEnabled*/)

pwcqBuilder.addTerm(field, new Term(field, "term1"));

pwcqBuilder.addTerm(field,new Term(field, "term2FirstChar"));

PhraseWildCardQuery pwcq = pwcqBuilder.build();

or

2nd way:

pwcqBuilder.addMultiTerm(MultiTermQuery object here contaning {field, "term1"} and {field ,"term2FirstChar"});

PhraseWildCardQuery pwcq = pwcqBuilder.build();


Then this pwcq object will be fed into IndexSearcher's as the query parameter.


Now, it looks like the first way will not consider expansions or in other words wildcard? Am i right?

i also need to understand this maxMultiTermExpansions parameter better. For instance if first way is used, will maxMultiTermExpansions be meaningful?


Thanks

Reply via email to