-
Notifications
You must be signed in to change notification settings - Fork 26
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
sorting by multiple fields #11
Comments
Thanks for your interest in the project. As you discovered when looking at the CLucene API, it does support sorting on multiple fields. Updating the BRFTS API to support this has been an outstanding task in the back of my mind for some time, actually. To that end, check out the multi-sort branch, where I've added two new methods: // parsed query with an array of sort descriptors
- (id <BRSearchResults> )search:(NSString *)query
withSortDescriptors:(nullable NSArray<id<BRSortDescriptor>> *)sorts;
// predicate query with an array of sort descriptors
- (id <BRSearchResults> )searchWithPredicate:(NSPredicate *)predicate
sortDescriptors:(nullable NSArray<id<BRSortDescriptor>> *)sorts; The BRSimpleSortDescriptor provides a basic implementation of If you'd like to try out this branch with your project, let me know how it goes for you and if all is well I can merge this into the next release. |
Thanks, I didn't see that branch. I'll investigate whether we can work within Lucene's limitations you mentioned, and if so, then indeed I'll be exercising this branch. Would you like me to email my feedback to you directly @msqr, or post it in this thread? |
Great! Go ahead and post any feedback on this thread if you can. |
Hi @jpmhouston did you have any luck using the multi-sort branch? I am likely to merge this in for the next release, but would be interested to hear if you tried it out. |
Didn't get a chance yet, and now the project is being shelved & I'm moving on so it looks like I won't ever. :^( |
Ah well, I have a few of unit tests in there at least, so I'll merge it in. Thanks! |
I don't know much about this Pod, or
CLucene
, but I'm faced with either adding multi-field sorting or abandoning this for another solution. Before I waste too much time, can someone say whether this would this work?In
CLuceneSearchService
changing thesortBy
argument in the internalsearchWithQuery:sortBy:sortType:ascending:
from anNSString
to anNSArray
, and its implementation like:Then making the obvious changes to
search:sortBy:..
andsearchWithPredicate:sortBy:...
to call it with... sortBy:@[sortFieldName]...
, and making additional methodssearch:sortByMultiple:..
andsearchWithPredicate:sortByMultiple:...
.I can do a pull request if this works.
The text was updated successfully, but these errors were encountered: