litewrite / litewrite

Distraction-free writing.
https://litewrite.net
GNU Affero General Public License v3.0
355 stars 53 forks source link

Search all document content #273

Closed jorinvo closed 6 years ago

jorinvo commented 8 years ago

Would be more helpful if the search finds matches from the whole content instead of just the title.

With this feature we should keep the search field always visible.

Would also be nice to highlight matches in the current document.

Since the browser kind of implements this already, it would be nice to be able to reuse the existing behavior instead of overwriting it with our own version.

Any ideas for that are appreciated!

okjustgo commented 6 years ago

It seems like searching all document content (rather than titles) would be a very useful enhancement, any particular reason this was closed?

jorinvo commented 6 years ago

From the commit:

Kill search feature

Search doesn't provide much value to Litewrite and we haven't found a seamless implementation. Can still discuss about a more polished version in the future. Keep it simple for now.

Would happily accept a Pull Request implementing search in a useful and seamless way :)

virtadpt commented 6 years ago

I wonder if one could plug Sphinx into the server to accomplish this...

jorinvo commented 6 years ago

@virtadpt there is no server in Litewrite. Everything is client-side. All documents to be searched are in memory. Implementing a simple text search would be not too difficult. The difficult part is finding a suitable user interface and user experience for it.

raucao commented 6 years ago

I found the search field quite alright the way it was. I was actually missing it a few times recently, because I keep quite a notes collection and I used search to find the older ones.

jorinvo commented 6 years ago

Okay, let's add search again. Let's search in the whole document and see how useful that is.

Can think about changing the sort order to show best matches at the top ("best" being matches where it matches in the title). Let's try displaying it only when there are at least ten documents (similar to the previous version, but simpler).

raucao commented 6 years ago

Can think about changing the sort order to show best matches at the top ("best" being matches where it matches in the title). Let's try displaying it only when there are at least ten documents (similar to the previous version, but simpler).

I like both ideas a lot.

jorinvo commented 6 years ago

@justSlone @virtadpt @skddc @jancborchardt search is back and looking better than ever (in my opinion). You can try it out at litewrite.github.io/litewrite. Would love to hear what you think and if you have any ideas on how to improve it further!

raucao commented 6 years ago

Looks great indeed!

Only issue I have is that it doesn't search titles (yet?).

jorinvo commented 6 years ago

It is searching whole documents for now. I guess it would be good to show title matches first.

raucao commented 6 years ago

I meant, it's actually not giving me results for title matches at all. But for the content it is.

jorinvo commented 6 years ago

The title is also part of the content so it should match, but I just realized that search was case-sensitive. I changed that now. Could you try again if that was the issue?

raucao commented 6 years ago

Yup, that worked! And man, do I enjoy it already. :)

jorinvo commented 6 years ago

I would leave it simply like this and to see if it is good enough. I think changing the sort order for best results might be not just extra complexity but also sometimes confusing.