Well, maybe you can work with the ComplexPhraseQueryParser, that's
been around for a while, see:
http://lucene.apache.org/core/4_10_1/queryparser/org/apache/lucene/queryparser/complexPhrase/ComplexPhraseQueryParser.html

Or you can just live with the inherent slop in the ~ operator. You
haven't really stated why this is an absolute requirement, it might be
best to relax the requirement a bit. It's up to you...

Best,
Erick

On Mon, Oct 27, 2014 at 8:12 AM, john eipe <john77e...@gmail.com> wrote:
> I have this line highlighted
>
>  <em>Jobs</em> was <em>born</em> in San Francisco, California on February
> 24 1955.
>
> for query "Jobs born"~15 but not for "born Jobs"~15. I want the same result
> irrespective of the order of search keywords.
>
> Regards,
> John Eipe
>
> “The Roots of Violence: Wealth without work, Pleasure without conscience,
> Knowledge without character, Commerce without morality, Science without
> humanity, Worship without sacrifice, Politics without principles”
> - Mahatma Gandhi
>
> On 25 October 2014 18:25, Erick Erickson <erickerick...@gmail.com> wrote:
>
>> Well, the syntax is wrong. You probably want content_raw:"jobs
>> born"~15. The way slop works, it is the number of "moves" so this will
>> match "jobs was a man born somewhere" and "all persons born include
>> jobs". The difference is that the version that has "born" first and
>> "jobs" second will take an extra move, so if the search is "jobs born"
>> and the text was "born jobs", the second one would require more slop.
>>
>> Best,
>> Erick
>>
>> On Sat, Oct 25, 2014 at 2:48 AM, john eipe <john77e...@gmail.com> wrote:
>> > Hi
>> >
>> > I'm trying to match keywords based on 2 fields and excluding order
>> > importance but with distance restriction.
>> >
>> > title:(Jobs) AND content_raw:(Jobs born)~15
>> >
>> > This throws error:
>> > org.apache.solr.search.SyntaxError: Cannot parse '(Jobs born)~15':
>> > Encountered " <FUZZY_SLOP> "~15 "
>> >
>> > What's the correct way to frame this query?
>> >
>> > Regards,
>> > *John Eipe*
>> >
>> > “The Roots of Violence: Wealth without work, Pleasure without conscience,
>> > Knowledge without character, Commerce without morality, Science without
>> > humanity, Worship without sacrifice, Politics without principles”
>> > - Mahatma Gandhi
>>

Reply via email to