lucene - How to do proximity search between phrases in SOLR? -


how can "x m" , "z k" in distance of 10 words or so?

i saw in word level "foo bar"~4 (proximity link)

can proximity search in pharses level , not in word level ?

if don't mind being bit looser on matching, this: "x m z k"~10. match want. would, however, match other things like: "x a m z a k". if can tolerate that, there easy answer. might edismax query parser's pf2 , ps2 parameters, see if can use close enough.

the surround query parser, way, designed around using spanqueries. seems query like: {!surround} 10w(1n(x, m), 1n(z, k)) work here, seems surround doesn't support nested parentheses, unless i'm missing something.

if aren't adequate needs, believe need build query through lucene api directly, rather through solr query syntax. combination of spanquerys job, like:

spanquery termx = new spantermquery(new term("fieldname", "x")); spanquery termm = new spantermquery(new term("fieldname", "m")); spanquery termz = new spantermquery(new term("fieldname", "z")); spanquery termk = new spantermquery(new term("fieldname", "k")); spanquery phrasexm = new spannearquery(new spanquery[] {termx, termm}, 0, true); spanquery phrasezk = new spannearquery(new spanquery[] {termz, termk}, 0, true); spanquery finalquery = new spannearquery(new spanquery[] {phrasexm, phrasezk}, 10, false); 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -