Thomas,

If you just want to provide suggested users names, and assuming that your 
suggestions will use the text entered so far as the start of the string, 
how about something like:

FOR u IN Users FILTER LEFT(u.lowerCaseUsername, LENGTH(@searchString)) == 
LOWER(@searchString) SORT u.lowerCaseUsername RETURN u

You could of course also throw a LIMIT statement on there to be sure you 
don't return too many results (maybe 10?)

On Wednesday, April 5, 2017 at 6:44:09 AM UTC-6, Thomas Weiss wrote:
>
> Hi everyone,
>
> A nice little issue that I've just encountered! :)
>
> I need to provide a case-insensitive search on some string field, where 
> the beginning of the string should suggest the different results.
> Ex: 'thom' and 'Thom' should find 'Thomas'
>
> Initially, I used a full-text index and it worked really great... until we 
> found out that some users had special characters like dots in their 
> usernames: 'i.M.O' for example. I guess that the full-text index strips all 
> punctuations, so those don't get indexed.
>
> So my current idea is to:
> - create a composite field that contains the lower-cased username
> - use a skiplist index on that field
> - search with FILTER newField >= 'query' && newField < 'query!'
> NOTE that '!' would be a character that is > than any other one; I still 
> have to find which character that would be as it seems that the normal 
> ASCII order is not respected: RETURN 'z' < '~' return false
>
> Any comment would be greatly appreciated!
>
> Thanks,
> Thomas
>

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to