word search problem

gunars
Posts: 189
Joined: Fri Nov 08, 2013 5:35 am
Contact:

word search problem

Postby gunars » Sat Jul 12, 2014 6:10 am

Here is a situation I just ran into (CN 2.7 beta 1) that is not what I expected.

1) Make a new note with title "test" and text "elephant horse".
2) Make a new note with title "test" and text "elephant goat".

3) Do a search ("Text and Title", SIW is off, SAFB is off). Search for "elephant -horse". As expected, only the note with "elephant goat" will be found.

4) Now, edit each note so the title is also "elephant" instead of "test".

5) When you do the same search for "elephant -horse", both notes are still displayed. The "-horse" has no effect.

6) If either SIW or SAFB is on, then it works as expected again.

7) It also works if I search only in "Text" instead of "Text and Title".

I think what is happening is that when the search for "elephant -horse" first finds "elephant" in the title, it then applies the "-horse" only to the title, not to the text field. Remember, SAFB is off. However, searching for "elephant horse" does manage to skip over the title and find both words in the text.

In any case, I don't understand why SIW has any effect in this situation.

Gunars
User avatar
CintaNotes Developer
Site Admin
Posts: 4689
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: word search problem

Postby CintaNotes Developer » Mon Jul 14, 2014 8:47 am

Hi Gunars,

Thanks for the report!
I can reproduce the problem, and can even explain it to some degree.

You are correct in your assumption that the note is found because the title has "elephant" and doesn't have "horse" - exactly like you requested. To fix this you need to turn on SAFB. No bug here.

However, searching for "elephant horse" does manage to skip over the title and find both words in the text.

And this is a bug. When SIW is off, CintaNotes uses full-text search with FTS3 SQLite extension, and it has some pecularities in this regard. This is also why the behavior is correct when you turn SIW on. In this case, FTS is not used.

I'll see if it can be fixed, but in general I think that the bug is relatively minor and a small price to pay for the FTS speed.

UPD: Actually I was wrong. This is not a bug. Your search is, literally: "find any notes which have both 'elephant' and 'horse' in either title or text . So the note that has 'elephant horse' in text is found. It's different with negation, where you say: 'find any notes which have 'elephant' but don't have 'horse' in either title or text'. This way, the note which has 'elephant' but doesn't have 'horse' in the title is found.
Alex
gunars
Posts: 189
Joined: Fri Nov 08, 2013 5:35 am
Contact:

Re: word search problem

Postby gunars » Mon Jul 14, 2014 4:58 pm

That makes sense although, as I said, it was not quite what I expected. My solution in this case was to remove the elephant from the title.

BTW, my actual notes don't contain animals, but pharmacies and street addresses :-)
User avatar
CintaNotes Developer
Site Admin
Posts: 4689
Joined: Fri Dec 12, 2008 4:45 pm
Contact:

Re: word search problem

Postby CintaNotes Developer » Tue Jul 15, 2014 5:22 pm

Yes I just started worrying about elephants :lol:
So we can consider the issue settled?
Alex
gunars
Posts: 189
Joined: Fri Nov 08, 2013 5:35 am
Contact:

Re: word search problem

Postby gunars » Tue Jul 15, 2014 9:10 pm

Yes, thanks Alex!

Gunars

Return to “Bug Reports”