java - Phrase matching over multiple fields -


here how now:

.. .setquery( filteredquery( multimatchquery(string.format("*%s*", query), "name", "address", "phone") .type(multimatchquerybuilder.type.cross_fields), geodistancefilter("location") .distance(radius, distanceunit.kilometers) .geodistance(geodistance.plane) .point(latitude, longitude) ) ) ..

the issue doesn't search partial phrases or parts of words.. wildcards..

i found matchphrasequery seems works 1 field.. there other way implement such search?

unfortunately, multi-match doesn't support query wildcards. instead of using multimatch, sounds may want take @ query string query, has more pattern matching flexibility, , can run against multiple fields. query string powerful, provides lucene query language use. dsl looks like:

    {         "query_string" : {             "fields" : ["name", "address", "phone"],             "query" : "*query*"         }     } 

and in java, along these lines:

.. .setquery(    filteredquery(        .querystring("*test*").field("name").field("phone").field("address"),        geodistancefilter("location")              .distance(radius, distanceunit.kilometers)              .geodistance(geodistance.plane)              .point(latitude, longitude)       ) ) .. 

wildcards , pattern matching @ search time discouraged, because of high computation cost. should try @ index time solution these fuzzy searching cases, using ngram tokenizer produce these partial matches on required fields. using different kinds of analyzers better search index, instead of trying bend query builders will.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -