YapDatabase icon indicating copy to clipboard operation
YapDatabase copied to clipboard

Get all results from a Full Text Search without searching

Open daniesy opened this issue 8 years ago • 3 comments

Hey everybody. I'm using Full Text Search to search for items in a table with UISearchController. When i first load the view, i want to display all results, without actually doing any searches. What's your recommendation for the best way of doing this?

I tried using 2 mappings and using a different ViewController for displaying results but they didn't seem like good enough solutions.

At the moment, i created a fixed constant column in the YapDatabaseFullTextSearch that every item will have and search for that. But i think it's kind of slow.

let handler = YapDatabaseFullTextSearchHandler.withObjectBlock({ (dict, collection, key, obj) in
        dict["each"] = "em0" // flag for each one
    }
})

daniesy avatar May 11 '16 06:05 daniesy

We use two mappings with separate tableViews managed by UISearchController+UITableViewController

chrisballinger avatar May 11 '16 19:05 chrisballinger

I saw this variant in sample file, but this way leads to lots of code duplication in the results UITableViewController....isn't there another way?

daniesy avatar May 11 '16 22:05 daniesy

you can point both tableView delegates at the same VC and then make a method like mappingsForTableView that you use in each delegate method

On Wed, May 11, 2016 at 3:14 PM, Danut Mihai Florian < [email protected]> wrote:

I saw this variant in sample file, but this way leads to lots of code duplication in the results UITableViewController....isn't there another way?

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/yapstudios/YapDatabase/issues/321#issuecomment-218606506

chrisballinger avatar May 12 '16 18:05 chrisballinger