yapstudios / YapDatabase

YapDB is a collection/key/value store with a plugin architecture. It's built atop sqlite, for Swift & objective-c developers.
Other
3.35k stars 363 forks source link

Get all results from a Full Text Search without searching #321

Open daniesy opened 8 years ago

daniesy commented 8 years ago

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
    }
})
chrisballinger commented 8 years ago

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

daniesy commented 8 years ago

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?

chrisballinger commented 8 years ago

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 < notifications@github.com> 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