How to get fuzzy matches

79 views
Skip to first unread message

samanth...@gmail.com

unread,
Dec 28, 2016, 12:57:36 AM12/28/16
to ZomboDB
Hi Eric,

I have the below requirement:

Ex:-

Indexed Data:  (one lakh records)
id, company_name, country, city, state

Input
company_name: "wipro software services technologies ltd"

I need to find fuzzy matches for given Input company_name against Indexed Data.

Can you please help me here?

Thanks,
Samanth

Eric Ridge

unread,
Dec 28, 2016, 6:08:20 AM12/28/16
to ZomboDB
Hi Samanth. We may have different definitions of "fuzzy", but read this section of the docs and see if it helps. If not, you might need to be more specific:

https://github.com/zombodb/zombodb/blob/master/SYNTAX.md#wildcards

eric
--
You received this message because you are subscribed to the Google Groups "ZomboDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zombodb+u...@googlegroups.com.
To post to this group, send email to zom...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/zombodb/8ad754bf-e458-4cb8-b957-e78169d5dbb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

samanth...@gmail.com

unread,
Jan 20, 2017, 6:24:59 AM1/20/17
to ZomboDB
Hi Eric,

I understand and tried some sample fuzzy. It is working partially to satisfy my requirement. But it is taking more time every time when I hit the database.

And also, I tried to hit the elasticsearch directly. I was not able to get the results. 

Is there any way to get the results from elasticsearch directly instead of zombo db?

Thanks,
Samanth

Eric Ridge

unread,
Jan 20, 2017, 7:12:27 AM1/20/17
to zom...@googlegroups.com
Hey Samanth!  I hope 2017 has been treating you well so far!

Can you give me some examples of the queries you're executing and details around timings?

Querying Elasticsearch directly isn't really a thing that's exactly supported by ZDB, but if you're using the latest v3.1.4, there are some things you can do via ZDB's query syntax to directly pass in JSON Elasticsearch query parts.

I'm happy to help but just need some more details.

eric

samanth...@gmail.com

unread,
Jan 24, 2017, 11:55:23 PM1/24/17
to ZomboDB
Hi Eric,

Please find the below example elasticsearch query that I want to search directly on elasticsearch:

elasticsearch sample query:

"query" : {
"bool" : {
"must" : [{
"wildcard" : {
"email" : "*wipro*"
}
}
]
}
}


Thanks,
Samanth

Eric Ridge

unread,
Jan 25, 2017, 1:54:43 PM1/25/17
to zom...@googlegroups.com
Well, that particular formulation is just a simple wildcard query:

  SELECT * FROM table WHERE zdb('table', ctid) ==> 'email:*wipro*';

Take a minute to go over the query syntax documentation -- it might help clear things up:  https://github.com/zombodb/zombodb/blob/master/SYNTAX.md

eric

Eric Ridge

unread,
Jan 26, 2017, 7:08:06 PM1/26/17
to zom...@googlegroups.com
Hi again, Samanth!  I meant to also link you the docs for the SQL function named "zdb_dump_query()".  It will show you what ES QueryDSL ZDB will generate for a given user query:


Using your example, it returns this:

# select zdb_dump_query('so_posts', 'email:*wipro*');     
    zdb_dump_query       
-------------------------
{                      +
  "wildcard" : {       +
    "email" : "*wipro*"+
  }                    +
}
(1 row)

You might find this helpful.

eric

Reply all
Reply to author
Forward
0 new messages