-
Notifications
You must be signed in to change notification settings - Fork 639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lucene.Net: 4.8 SetNextReader executes repeatedly and returns only one result #915
Comments
Maybe I am missing something, but why aren't you using the built-in string comparer (TermOrdValComparer) with reverse support? lucenenet/src/Lucene.Net.Tests/Search/TestSort.cs Lines 350 to 384 in bed207a
lucenenet/src/Lucene.Net.Tests/Search/TestSort.cs Lines 279 to 312 in bed207a
If the custom public override void Copy(int slot, int doc)
{
termCopy = new BytesRef(); // Expensive allocation. This method will be called a lot.
sortedResults.Get(doc, termCopy);
bvalues[slot] = termCopy;
}
public override int CompareBottom(int doc)
{
BytesRef termOrd = new BytesRef(); // Expensive allocation. This method will be called a lot.
int ord = sortedResults.GetOrd(doc);
sortedResults.LookupOrd(ord, termOrd); // Expensive lookup. The TermOrdValComparer only does lookups in the Copy() method and only when necessary.
var result = DoCompare(bvalues[bottomSlot], termOrd);
return result;
} Also, the TermOrdValComparer uses ords to do the comparison in most cases, falling back to term comparison only when necessary. See the |
See response from @NightOwl888 above. Feel free to reopen if you feel like there is more to discuss here. Thanks! |
Is there an existing issue for this?
Task description
I updated from Lucene from 3.0 to 4.8, I amended my FieldComparer code. I use a comparator to get results back and I get the results via the call to SetNextReader. I only have 1 indexreader to read from:
the older verison SetNextReader is executed once correctly and returning 100 results of while the new SetNextReader executes multiple time and returning only one result. Attached is my old and new code. The searcher is setup like this:
The text was updated successfully, but these errors were encountered: