Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 1.8.x

queries using "like" of mysql ?

3 replies [Last post]
  • Login or register to post comments
Thu, 11/01/2012 - 09:33
jackalpret
Offline
Joined: 11/01/2012
Groups: None

Hi, I need to search some word into different columns.

For example here:
{"total_rows":10,"rows":[
{"id":"post_0","key":"This is Post 0","value":["blablablabla blabla anibal 0","http://www.xxxx0.com/0"]},
{"id":"post_1","key":"This is Post 1","value":["blabla anibal 1","http://www.xxxx1.com/1"]},
{"id":"post_2","key":"This is Post 2","value":["anibal 2","http://www.xxxx2.com/2"]},
{"id":"post_5","key":"This is Post 5","value":["blablablabla blabla anibal 5","http://www.xxxx5.com/5"]},
{"id":"post_6","key":"This is Post 6","value":["anibal 6","http://www.xxxx6.com/6"]},
{"id":"post_7","key":"This is Post 7","value":["blablablabla blabla anibal 7","http://www.xxxx7.com/7"]},
]
}

i want to get only post that contain the word "bla" for example:
{"id":"post_0","key":"This is Post 0","value":["blablablabla blabla anibal 0","http://www.xxxx0.com/0"]},
{"id":"post_1","key":"This is Post 1","value":["blabla anibal 1","http://www.xxxx1.com/1"]},
{"id":"post_5","key":"This is Post 5","value":["blablablabla blabla anibal 5","http://www.xxxx5.com/5"]},
{"id":"post_7","key":"This is Post 7","value":["blablablabla blabla anibal 7","http://www.xxxx7.com/7"]},

Top
  • Login or register to post comments
Fri, 11/02/2012 - 05:42
Saran
Offline
Joined: 11/02/2012
Groups: None

One way you can do this is by taking a back up of the data file(.mb file), convert into .sql file and load it into sqlite. Then you can login into sqlite db and run the query.
(OR)
The .sql file generated is kind of a unix text file which you can grep(or use other unix utilities) for the data you need.

/opt/couchbase/bin/cbbackup /opt/couchbase/var/lib/couchbase/data/default-data/default /tmp/

/opt/couchbase/bin/sqlite3 default-1.mb .dump > /tmp/default1.sql

Top
  • Login or register to post comments
Fri, 11/02/2012 - 06:03
jackalpret
Offline
Joined: 11/01/2012
Groups: None

thanks, but i allready have mysql ... i don't want to continue with this.

I'm looking new solution to do search engine ...

for example using solr or elastic search, but elastic search with couchbase doesnt work for me :(

Top
  • Login or register to post comments
Mon, 11/05/2012 - 10:12
scalabl3
Offline
Joined: 07/18/2012
Groups:

This post is in the 1.8 Forums, so I am assuming you are using 1.8.x. Integration is not automated in 1.8.x. In order to integrate Elastic Search with 1.8 you actually have to do a "workaround" in your application code. The way you do it is through "dual-writing" techniques. Using Ruby it's pretty straightforward.

In your *Application Code•: On every document Create, you also create in Elastic Search, but only send it the fields and ID that you require. On Delete, you delete from Elastic Search. There are many ways of doing this. It's a "dual-write" pattern. It's really only a workaround.

Couchbase 2.0 offers more tightly integrated solutions as well as integrated Map/Reduce to do much of what you are trying to do. Elastic Search and Map/Reduce are features of Couchbase 2.0 that would allow you to do text based indexes searches on JSON values (Documents). This is why we are so excited about 2.0.

__________________

@scalabl3
Technical Evangelist
Couchbase Inc.
 

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker