Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

N1QL queries and full-text search in Couchbase Mobile 2.0 – Couchbase Connect New York 2017

475 views

Published on

N1QL and full-text search come to Couchbase Mobile! In this session you’ll be one of the first to get your hands on N1QL queries and full-text search in Couchbase Mobile 2.0.
You’re building a scalable mobile app that needs fast, secure access to your embedded database. N1QL from Couchbase now combines the querying power of SQL with the modeling flexibility of JSON for your gaming, enterprise, or IoT mobile application.
Or maybe you’re building a mobile app that accesses lots of unstructured textual data coming from social media feeds or product information from an eCommerce catalog. You know that magnifying glass you see on every website? It's often full-text search. You want to be able to run faceted search or show a search result in context in your mobile app. What you need is high-performance full-text searching capabilities in your embedded database.

Published in: Software
  • Be the first to comment

  • Be the first to like this

N1QL queries and full-text search in Couchbase Mobile 2.0 – Couchbase Connect New York 2017

  1. 1. ©2017 Couchbase Inc. Query and FTS in Couchbase Mobile 2.0 1
  2. 2. ©2017 Couchbase Inc. Agenda • Travel sample demo • Travel sample bucket for Mobile • Queries in a Swift playground • Total document count in the database • WHERE clause • Comparison operators • equalTo • Like • greaterThan • AND clause • OrderBy clause • Full-text Search • Word matching in a Swift playground • Supported languages 2
  3. 3. ©2017 Couchbase Inc.©2017 Couchbase Inc. 3 Travel sample bucket & app
  4. 4. ©2017 Couchbase Inc.©2017 Couchbase Inc. 4 Mobile travel sample data
  5. 5. ©2017 Couchbase Inc. Travel sample bucket • 35 000 documents. • Documents of type airline, route, airport and hotel. • Rich data models to demonstrate Query and FTS. • Bundled in Couchbase Server. 5
  6. 6. ©2017 Couchbase Inc. Mobile travel sample bucket 6
  7. 7. ©2017 Couchbase Inc. Mobile travel sample bucket – importing documents • Documents from the travel sample bucket must be imported in Sync Gateway. 7 { "databases": { "db": { "bucket": "travel-sample", "server": "http://localhost:8091", "import_docs": true, "users": { "GUEST": {"admin_channels": ["*"], "disabled": false} } } } }
  8. 8. ©2017 Couchbase Inc. Mobile travel sample bucket – replicating documents 8 // Create replicators to push & pull changes to & from Sync Gateway let url = URL(string: "http://localhost:4984/db")! let push = database.createPushReplication(url) let pull = database.createPullReplication(url) push.continuous = true pull.continuous = true // Start replicators push.start() pull.start()
  9. 9. ©2017 Couchbase Inc. Mobile travel sample bucket – opening database with CBL 2.0 1. Couchbase Lite default directory • /Library/Application Support/CouchbaseLite/travel-sample.cblite2 • Automatically created when opening a new database. 2. Copy it to the Swift playground data directory • Documents directory: /Users/jamesnocentini/Documents/Shared Playground Data 3. Open database 9 let documentsDirectory = playgroundSharedDataDirectory.path var options = DatabaseOptions() options.directory = documentsDirectory let database = try? Database(name: "travel-sample", options: options)
  10. 10. ©2017 Couchbase Inc.©2017 Couchbase Inc. 10 Travel sample data models
  11. 11. ©2017 Couchbase Inc.©2017 Couchbase Inc. 11 Query
  12. 12. ©2017 Couchbase Inc.©2017 Couchbase Inc. 12 FTS
  13. 13. ©2017 Couchbase Inc. Supported languages • FTS4 • 3rd party tokenizer/stemmer • Danish, Dutch, English, Finnish, French, German, Hungarian, Italian, Norwegian, Portuguese, Spanish, Swedish, Romanian, Russian,Turkish 13
  14. 14. ©2017 Couchbase Inc.©2017 Couchbase Inc. ThankYou! 14

×