organice icon indicating copy to clipboard operation
organice copied to clipboard

Expand search: text in description

Open tarnung opened this issue 3 years ago • 3 comments

Continuation of the discussion in #504

Should descriptions only be searched when explicitly queried with a search term like desc: like for timestamps or should their text be a part of regular word search?

Should the raw description be used for search or should only certain parts ( as in header.get('description').filter(d=>d.get('type')==='text')) be used?

tarnung avatar Oct 16 '20 15:10 tarnung

Thanks for already tackling the next issue^^

Should descriptions only be searched when explicitly queried with a search term like desc: like for timestamps or should their text be a part of regular word search?

The former.

Should the raw description be used for search or should only certain parts ( as in header.get('description').filter(d=>d.get('type')==='text')) be used?

The latter.

munen avatar Oct 16 '20 15:10 munen

Should the raw description be used for search or should only certain parts ( as in header.get('description').filter(d=>d.get('type')==='text')) be used?

The latter.

Are you sure @munen? E.g. *bold* would not be found then – which is arguably OK.

But what is with this query:

desc:"two words"

when the actual text is two *words*?

IMO it would be best to match header.get('descriptionAsPlainText') or just header.get('rawDescription')... the first doesn't exist though.

schoettl avatar Oct 16 '20 16:10 schoettl

Are you sure @munen?

Apologies. I had some memory of rawDescription including all the other metadata (like PROPERTIES and planning items) which is just a wrong memory:

image

With the current data we have, searching in rawDescription is likely the best. To get around the markup issue you mentioned, we could exclude the common markup (‘bold’, ‘/italic/’, ‘underlined’, ‘=verbatim=’ and ‘~code~’, ‘+strike-through+’.) in search.

Quick'n'dirty POC:

munen@lambda:~% node
> 'two *words*'.replace(/\*([\w]*)\*/, (match, p1, offset, string) => p1).match(/two words/)
[ 'two words', index: 0, input: 'two words', groups: undefined ]

Thank you for double checking on me, @schoettl!

munen avatar Oct 16 '20 17:10 munen

I would find this feature very useful, was there any progress?

neildavidforrest avatar Oct 22 '22 14:10 neildavidforrest

was there any progress?

Yes! There's a volunteer for the issue at hand. @neildavidforrest, would you like to take over implementation? I'm happy to help with testing and documentation.

munen avatar Oct 23 '22 09:10 munen

Sure I can give it a shot. It will take me a while to get up to speed, but the information in https://github.com/200ok-ch/organice/pull/505 seems very useful.

neildavidforrest avatar Oct 24 '22 23:10 neildavidforrest

Sure I can give it a shot. It will take me a while to get up to speed, but the information in https://github.com/200ok-ch/organice/pull/505 seems very useful.

@neildavidforrest #505 is certainly a good place to have a look into how the search setup is implemented. There's also a bit of documentation to get you started from the top: https://organice.200ok.ch/documentation.html#search_grammar

Good luck and have fun!

munen avatar Oct 26 '22 14:10 munen

I have a proof of concept version working locally, I will try to put a PR together soon after some further refinement. For example I have not yet implemented the filtering of markup characters described above.

image

A useful extension to this might be to show a preview of the matched text in the search results, as currently you only see the headline text, so it is difficult to appreciate the context of the match (and clicking the result to see the context will reset your search).

But one thing at a time...

neildavidforrest avatar Oct 26 '22 21:10 neildavidforrest

@munen Please see https://github.com/200ok-ch/organice/pull/907, thank you.

neildavidforrest avatar Dec 02 '22 10:12 neildavidforrest

Closed by https://github.com/200ok-ch/organice/pull/907

Thank you, @neildavidforrest :pray: :bow:

munen avatar Dec 02 '22 13:12 munen