tile38 icon indicating copy to clipboard operation
tile38 copied to clipboard

Support searching from Muti JSON documents ?

Open icewukong opened this issue 8 years ago • 12 comments

For example:

   SET roads road1 OBJECT {"type": "LineString",coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0,0.0],[105.0, 1.0]]},"properties": {"prop0": "value0","prop1": 0.0}}
   SET roads road2 OBJECT {"type": "LineString",coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0,0.0],[105.0, 1.0]]},"properties": {"prop0": "value1","prop1": 2.0}}

I want to return the object that it's "prop0" equal "value1",with a command: JSEARCH key MATCH path e.g. JSEARCH roads MATCH properties.#[prop0=="value1"]#

icewukong avatar Feb 08 '17 04:02 icewukong

It's possible, but it would be slow. An O(n) operation. Would that be OK?

tidwall avatar Feb 08 '17 04:02 tidwall

How about to create a index,like buntdb? Despite this will expose the concept of the index. Maybe it need to provide a command to create a custom index. Anyway,for me, it's better to be slow than not. Thank you for reply!

icewukong avatar Feb 08 '17 05:02 icewukong

BTW, Is the SEARCH operation on type STRING an O(n) operation?

icewukong avatar Feb 08 '17 05:02 icewukong

No, the STRING type goes into a Btree. It's in binary order. O(log n) We may be able to add a command for creating indexes for collections. Similar to SETINDEX in SummitDB.

tidwall avatar Feb 08 '17 05:02 tidwall

That would be best!

icewukong avatar Feb 08 '17 06:02 icewukong

All right. I'll investigate further. Thanks for you input.

tidwall avatar Feb 08 '17 06:02 tidwall

Will the ability that searching from Muti JSON documents be available in version 2.x ? Same as issue #200 would be OK.

icewukong avatar Aug 07 '17 08:08 icewukong

I hope so. I'm experimenting with new SETINDEX & DELINDEX commands, and an updated SEARCH command that will allow for indexed queries on the STRING type.

tidwall avatar Aug 07 '17 16:08 tidwall

Looking forward to your project 2.0 :+1:

icewukong avatar Aug 08 '17 00:08 icewukong

Hi,

May I know the commands to search with json field using NEARBY and WHERE ?

For example:

127.0.0.1:9851> jset test 1 outstation dharwad {"ok":true,"elapsed":"49.379µs"}

127.0.0.1:9851> get test 1 {"ok":true,"object":{"type":"Point","coordinates":[-84.4767280575,45.6304059969,100],"outstation":"dharwad"},"elapsed":"34.099µs"}

127.0.0.1:9851> nearby test where outstation dharwad 6000 (error) invalid argument 'dharwad'

kirantpatil avatar Aug 20 '20 13:08 kirantpatil

I hope so. I'm experimenting with new SETINDEX & DELINDEX commands, and an updated SEARCH command that will allow for indexed queries on the STRING type.

@tidwall: May I know any updates on this feature ?

kirantpatil avatar Sep 07 '20 07:09 kirantpatil

Hi @kirantpatil. Sorry but this feature is on hold and I don’t have any plans at the moment to implement right now.

tidwall avatar Sep 07 '20 13:09 tidwall