Hellp in query design

Not a direct ES question but maybe someone can help.

Given a string : "Fitness & Sports | Racquet Sports | Bags"

I would like a query that matches it given input :

  • Bag Sport
  • Bags Sport
  • Sport Bag
  • Sports ba

And so on. I have tried to use the match_phrase_prefix query , but the slop
issue does not seems to work right. it matches the second 2 but not the
first 2

here is the query :

{
"match" : {
"path" : {
"query" : "dfs",
"type" : "phrase_prefix",
"slop" : 20,
"fuzziness" : "0.1",
"max_expansions" : 200
}
}
}

THanks for help

--

(after some analysis using an index sample provided by Roman):
This looks to be an analysis issue -- a query for "sports bags" works fine
in this case, which leads me to believe you neglected to specify the
correct analysis settings at index/query time.

On Sunday, December 9, 2012 12:07:42 AM UTC+2, Roman Kournjaev wrote:

Not a direct ES question but maybe someone can help.

Given a string : "Fitness & Sports | Racquet Sports | Bags"

I would like a query that matches it given input :

  • Bag Sport
  • Bags Sport
  • Sport Bag
  • Sports ba

And so on. I have tried to use the match_phrase_prefix query , but the
slop issue does not seems to work right. it matches the second 2 but not
the first 2

here is the query :

{
"match" : {
"path" : {
"query" : "dfs",
"type" : "phrase_prefix",
"slop" : 20,
"fuzziness" : "0.1",
"max_expansions" : 200
}
}
}

THanks for help

--

So here is one for the foundation

I changed the query to :

{
"query_string" : {
"query" : "bag spor",
"default_field" : "path",
"default_operator" : "or",
"boost" : 0.5,
"fuzzy_prefix_length" : 3,
"phrase_slop" : 20
}
}

And made the field "path" that was the default query field being analyzed
with the snowball analyzer.
Dont know if thats the optimal solution , but it work for me.

On Sunday, December 9, 2012 1:49:11 PM UTC+2, Tomer Gabel wrote:

(after some analysis using an index sample provided by Roman):
This looks to be an analysis issue -- a query for "sports bags" works fine
in this case, which leads me to believe you neglected to specify the
correct analysis settings at index/query time.

On Sunday, December 9, 2012 12:07:42 AM UTC+2, Roman Kournjaev wrote:

Not a direct ES question but maybe someone can help.

Given a string : "Fitness & Sports | Racquet Sports | Bags"

I would like a query that matches it given input :

  • Bag Sport
  • Bags Sport
  • Sport Bag
  • Sports ba

And so on. I have tried to use the match_phrase_prefix query , but the
slop issue does not seems to work right. it matches the second 2 but not
the first 2

here is the query :

{
"match" : {
"path" : {
"query" : "dfs",
"type" : "phrase_prefix",
"slop" : 20,
"fuzziness" : "0.1",
"max_expansions" : 200
}
}
}

THanks for help

--