Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behaviour of scout changed in 3.0.0 version #4

Closed
projectlkp opened this issue Feb 1, 2018 · 7 comments
Closed

Behaviour of scout changed in 3.0.0 version #4

projectlkp opened this issue Feb 1, 2018 · 7 comments

Comments

@projectlkp
Copy link

Search Not working for substrings.
Example:
scout.create_document("hello this is just a dummy text","articles")

and searching http://localhost:8000/articles/?q=ello
does not give any result

@coleifer
Copy link
Owner

coleifer commented Feb 1, 2018

What SQLite full-text search version were you using previously? Was your SQLite compiled with support for FTS5?

@coleifer
Copy link
Owner

coleifer commented Feb 1, 2018

You know, I'm not sure that this actually worked as you described it... I tried running some SQL locally:

-- create fts4 and fts5 tables
create virtual table idx4 using "fts4" (content);
create virtual table idx5 using "fts5" (content);

-- insert 3 sample rows into each
insert into idx4 (content) values ('hello world'), ('this is a test'), ('python is wonderful');
insert into idx5 (content) values ('hello world'), ('this is a test'), ('python is wonderful');

-- query index using complete and partial strings
select * from idx4 where idx4 match 'hello';
-- returns hello world

select * from idx4 where idx4 match 'hell';
-- no results returned

select * from idx4 where idx4 match 'ello';
-- no results returned

select * from idx5 where idx5 match 'hello';
-- returns hello world

select * from idx5 where idx5 match 'hell';
-- no results returned

select * from idx5 where idx5 match 'ello';
-- no results returned

@coleifer
Copy link
Owner

coleifer commented Feb 1, 2018

Y'know, I think this might be the difference that is causing the issue you've seen:

scout/scout.py

Line 108 in 3107c01

'prefix': [2, 3],

Let me re-add the prefix option and see what happens.

@coleifer
Copy link
Owner

coleifer commented Feb 1, 2018

Well, that didn't really change anything :/ Nevermind.

@coleifer
Copy link
Owner

coleifer commented Feb 1, 2018

Feel free to add more info here in the comments. In the meantime I am going to close this.

@coleifer coleifer closed this as completed Feb 1, 2018
@rajatsingla
Copy link

rajatsingla commented Feb 3, 2018

Funnily enough this doesn't work for english, works for hindi.

-- create fts4 and fts5 tables
create virtual table idx4 using "fts4" (content);
create virtual table idx5 using "fts5" (content);

-- insert 1 sample rows into each
insert into idx4 (content) values ('नीरजा भनोट के कातिल पाकिस्तान की जेल में थे, फिर वे एफबीआई आए?');
insert into idx5 (content) values ('नीरजा भनोट के कातिल पाकिस्तान की जेल में थे, फिर वे एफबीआई आए?');

-- query index using complete and partial strings
select * from idx4 where idx4 match 'पाकिस्तान';
-- returns नीरजा भनोट के कातिल पाकिस्तान की जेल में थे, फिर वे एफबीआई आए?

select * from idx4 where idx4 match 'पाकि';
-- no results returned

select * from idx5 where idx5 match 'पाकिस्तान';
-- returns नीरजा भनोट के कातिल पाकिस्तान की जेल में थे, फिर वे एफबीआई आए?

select * from idx5 where idx5 match 'पाकि';
-- returns नीरजा भनोट के कातिल पाकिस्तान की जेल में थे, फिर वे एफबीआई आए?

@coleifer
Copy link
Owner

coleifer commented Feb 4, 2018

Strange! I have no idea what's going on but you may want to bring this up on the SQLite-users mailing list if you're curious for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants