been trying lucene search work simple example. user able search multiple words , want bring results has been weighted if complete sentence matched. have highest score compared results 1 word matched.
at moment search seems split search term individual words , never bothers search complete sentences or part of sentence.
i unsure need passing parser @ moment. below search returns query "hello" , "kitty" separate searches.
query searchquery = multifieldqueryparser.parse(lucene.net.util.version.lucene_current, // phrase, new string[] { "hello kitty"}, new[] { "description", }, new[] { booleanclause.occur.should, booleanclause.occur.should, booleanclause.occur.should, }, new lucene.net.analysis.standard.standardanalyzer());
i'm sure must easy implement unsure how go it
what u mean separate searches?
description:hello or description:kitty
?
even in case, document description contains both hello , kitty scored higher compared documents containing hello or kitty (i'm assuming document length , repetitions of terms remain more or less same across documents)
you can modify above query appending phrase query.
description:"hello kitty" or description:hello or description:kitty
Comments
Post a Comment