Re: [sqlite] FTS3/FTS4 - Finding the term(s) that completes the input

2011-11-22 Thread Mohit Sindhwani

Hi Simon, Abhinav and Filip,

On 21/11/2011 11:32 AM, Simon Slavin wrote:

You have to look at the rows it returns and see how many of them there are.  If 
there's only one, that's your hit.  If there are more than one, see how many 
characters you can move along the row before they start to be different.  For 
instance suppose I have

Jones, Jenny
Smith, John
Smith, James
Zbignew, Andrew

Immediately they type 's', by looking at the two rows returned you can move all 
the way along to the 'j' before the strings are different.  The only efficient 
way to do it is programming.


Thanks for your inputs - I think I have enough material now to work 
from.  I should be able to achieve what I'm after based on what you've 
said so far.


Time for me to put in my energy now :-)

Best Regards,
Mohit.
23/11/2011 | 2:39 AM.


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] FTS3/FTS4 - Finding the term(s) that completes the input

2011-11-21 Thread Mohit Sindhwani

Hi Filip,


On 21/11/2011 4:33 PM, Filip Navara wrote:

On Mon, Nov 21, 2011 at 4:13 AM, Mohit Sindhwani  wrote:


I think my examples muddied the waters.  I have looked at Section 3 of the
FTS documents and that lets me bring back the "full result" that matches -
so, if I search for 'ling j', it can tell me that the result that matches
is 'james ling, alibaba'.  What it does not let me do is figure out that
the partly entered term "j" completes to the word 'james' - that is the
part I'm trying to figure out.

Best Regards,
Mohit.


http://sqlite.org/fts3.html#section_4_1



I am so sure that I read this part so many times... and I always missed 
it!  This will obviously help a lot!


Best Regards,
Mohit.
21/11/2011 | 8:36 PM.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] FTS3/FTS4 - Finding the term(s) that completes the input

2011-11-21 Thread Filip Navara
On Mon, Nov 21, 2011 at 4:13 AM, Mohit Sindhwani  wrote:

> Hi Abhinav,
>
>
> On 21/11/2011 2:52 AM, Abhinav Upadhyay wrote:
>
>> On Mon, Nov 21, 2011 at 12:17 AM, Mohit Sindhwani  wrote:
>>
>>> What I'd like to be able to do is something like this:
>>>
>>> - let's say that the FTS4 table has values such as:
>>> * mohit sindhwani, onghu
>>> * john doe, gmail
>>> * james ling, alibaba
>>> * john barn, yahoo
>>> ...and so on
>>>
>>> If the user enters "j", I'd like to suggest that this would complete to
>>> the
>>> words:
>>> john and james in the current set
>>>
>>> If the user enters 'ling j', I'd like to restrict it and say:
>>>
 james is the only word that can be matched now
 james ling, alibaba is the result

>>>
>>> I think you might want to look at Token Prefix queries:
>>> http://sqlite.org/fts3.html#**section_3
>>>
>>
> I think my examples muddied the waters.  I have looked at Section 3 of the
> FTS documents and that lets me bring back the "full result" that matches -
> so, if I search for 'ling j', it can tell me that the result that matches
> is 'james ling, alibaba'.  What it does not let me do is figure out that
> the partly entered term "j" completes to the word 'james' - that is the
> part I'm trying to figure out.
>
> Best Regards,
> Mohit.


http://sqlite.org/fts3.html#section_4_1

Best regards,
Filip Navara
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] FTS3/FTS4 - Finding the term(s) that completes the input

2011-11-20 Thread Simon Slavin

On 21 Nov 2011, at 3:13am, Mohit Sindhwani wrote:

> I think my examples muddied the waters.  I have looked at Section 3 of the 
> FTS documents and that lets me bring back the "full result" that matches - 
> so, if I search for 'ling j', it can tell me that the result that matches is 
> 'james ling, alibaba'.  What it does not let me do is figure out that the 
> partly entered term "j" completes to the word 'james' - that is the part I'm 
> trying to figure out.

You have to look at the rows it returns and see how many of them there are.  If 
there's only one, that's your hit.  If there are more than one, see how many 
characters you can move along the row before they start to be different.  For 
instance suppose I have

Jones, Jenny
Smith, John
Smith, James
Zbignew, Andrew

Immediately they type 's', by looking at the two rows returned you can move all 
the way along to the 'j' before the strings are different.  The only efficient 
way to do it is programming.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] FTS3/FTS4 - Finding the term(s) that completes the input

2011-11-20 Thread Mohit Sindhwani

Hi Abhinav,

On 21/11/2011 2:52 AM, Abhinav Upadhyay wrote:

On Mon, Nov 21, 2011 at 12:17 AM, Mohit Sindhwani  wrote:

What I'd like to be able to do is something like this:
- let's say that the FTS4 table has values such as:
* mohit sindhwani, onghu
* john doe, gmail
* james ling, alibaba
* john barn, yahoo
...and so on

If the user enters "j", I'd like to suggest that this would complete to the
words:
john and james in the current set

If the user enters 'ling j', I'd like to restrict it and say:

james is the only word that can be matched now
james ling, alibaba is the result


I think you might want to look at Token Prefix queries:
http://sqlite.org/fts3.html#section_3


I think my examples muddied the waters.  I have looked at Section 3 of 
the FTS documents and that lets me bring back the "full result" that 
matches - so, if I search for 'ling j', it can tell me that the result 
that matches is 'james ling, alibaba'.  What it does not let me do is 
figure out that the partly entered term "j" completes to the word 
'james' - that is the part I'm trying to figure out.


Best Regards,
Mohit.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] FTS3/FTS4 - Finding the term(s) that completes the input

2011-11-20 Thread Abhinav Upadhyay
On Mon, Nov 21, 2011 at 12:17 AM, Mohit Sindhwani  wrote:
> Hi, I'm finding my way through FTS3/FTS4 to replace some of the old code
> that we have for searching terms within titles.  I now know that FTS3/4
> should be the way to proceed.
>
> So far, I have this:
> - an FTS4 table that has two columns: title (main column), ext (certain
> conditions to match)
> - an FTS4aux table
>
> What I'd like to be able to do is something like this:
> - let's say that the FTS4 table has values such as:
> * mohit sindhwani, onghu
> * john doe, gmail
> * james ling, alibaba
> * john barn, yahoo
> ...and so on
>
> If the user enters "j", I'd like to suggest that this would complete to the
> words:
> john and james in the current set
>
> If the user enters 'ling j', I'd like to restrict it and say:
>> james is the only word that can be matched now
>> james ling, alibaba is the result
>
> Similarly, if the user enters 'yahoo j', I should be able to zoom in to
> 'john barn, yahoo'.
>
> I think this should be within the reach of FTS3/FTS4, but I'm having trouble
> framing the queries, etc.  Are you able to nudge me in the correct
> direction?
>
> Thanks,
> Mohit.

I think you might want to look at Token Prefix queries:
http://sqlite.org/fts3.html#section_3

--
Abhinav
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users