how fuzzy query works ?

457 views
Skip to first unread message

Nicolas R

unread,
Mar 24, 2015, 10:20:05 AM3/24/15
to elastica-...@googlegroups.com
Hi,
I'm trying to implement fuzzy query with fos elastica (over symfony2). I succed to perform a perfect match, but i would like to select all entries which have their field source matching minimum 80% of the selected one.
Then, i would like to be able to sort the results by their matching score (eg: 1st: 100%, 2nd: 95%, 3rd: 85% etc..).
Below what i have tested, but i don't understand the difference between the fuzzy and minimumShouldMatch score.

        $fieldQuery = new \Elastica\Query\Match();
        $fieldQuery
->setFieldQuery('source', $data->getSource());
        $fieldQuery
->setFieldMinimumShouldMatch('source', '80%');
       
//$fieldQuery->setFieldFuzziness('source', AUTO);        
        $boolQuery
->addMust($fieldQuery);

Any help ?
Nicolas

ruflin

unread,
Apr 3, 2015, 11:28:03 PM4/3/15
to elastica-...@googlegroups.com
Sorry for the late help. Did you have a look at the elasticsearch documentation? http://www.elastic.co/guide/en/elasticsearch/reference/1.3/query-dsl-match-query.html
Reply all
Reply to author
Forward
0 new messages