Does 'Suggests' work with a one-character input query?

19 views
Skip to first unread message

Justin A

unread,
Mar 22, 2017, 1:28:51 AM3/22/17
to RavenDB - 2nd generation document database
Hi :)

I'm trying to tweak my code that leverages the Suggest() feature/keyword.

var suggestedResults = await asyncDocumentSession
                            .Query<Foo_Bar.Result, Foo_Bar>()
                            .SuggestAsync(new SuggestionQuery
                            {
                                Field = "NameOrTag",
                                Term = modifiedQuery,
                                MaxSuggestions = take
                            }).ConfigureAwait(false);


ModifiedQuery | Results   | ResultCount
----------------------------------------
ke*           | keys      | 1
ke            | sky, keys | 2
keeeys*       | keys      | 1  // Typo - and correct answer!
k*            | null      | 0
3*            | null      | 0
3             | null      | 0

I was expecting the bottom results to have multiple results. Not zero/null.


Is my problem that I'm using a '*' in the `Term`? I thought that wildcard applies at all times?

I'm trying to ask RavenDb/lucene for anything it thinks might be a suggested word (as opposed to 'starts with'). I can't use starts with (at this point) because of typo's in the word .. which is why Suggests is a great helper.

-just me-

Idan Haim

unread,
Mar 22, 2017, 9:44:01 AM3/22/17
to RavenDB - 2nd generation document database
Can you please share your Query and Index definition?

Oren Eini (Ayende Rahien)

unread,
Mar 22, 2017, 10:27:17 AM3/22/17
to ravendb
Suggest isn't using wildcards like this.
Try it without the wildcard, and I'm pretty sure it wouldn't work. Suggestions don't work based on prefix, but based on distance.

For example, on your dataset, "deys" will find keys.
But the key here is that "k" and "keys" are quite far apart, so it is filtered, probably

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


On Wed, Mar 22, 2017 at 3:44 PM, Idan Haim <id...@ravendb.net> wrote:
Can you please share your Query and Index definition?

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages