-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
enhancement: add several improvements to local search #1612
Conversation
It's cool! It's exactly what i was want from searchbox. I will test it soon. |
@ivan-nginx Thanks for your testing. I cannot find all the corner cases by myself. Found any bug, tell me ^_^ |
@ivan-nginx I fix both of the bugs. Now title is shown with correct letter case, and result is shown with all keyword hits. Demo: I also adjust the algorithm to order results by the hit count in article. I will update pull request later. Welcome for more bug reports. |
- fix: let titles be shown with correct letter case instead of all lower case - fix: when you input several keywords, all the keywords' result will be shown - feature: sort result by hit count in article
@uchuhimo seems u profi. GJ and thank's! |
What does "profi" means? Google Translate tells me that "profi" is German and means "professional", is it right? I guess "profi" is abbreviation of "professional" in English. But I'm not sure. I'm not a native English speaker. Just out of curiosity ^_^ |
@uchuhimo > I guess "profi" is abbreviation of "professional" in English. |
@uchuhimo u got e-mail? What u think? |
@ivan-nginx seems your e-mail is treated as spam by Outlook. I have checked them just now. You report 2 bugs in your e-mails:
Are there any other bugs? Send them to me together. Thanks~ |
@uchuhimo no no, that's all bugs for now. I just think what u don't understand this bugs or anotther any things, cause u not give some answers.
Yes, i will send it on your e-mail.
Need just to add button to search at the left, for example. Issue is that when you press the buttons on keyboard — appear some delay and search do on each button pressed. I think, we may add some option for auto search and for search by press search button, that's what i mean. |
Sorry for the delay. I cannot get notification if a e-mail is treated as spam.
How about trigger search by pressing enter? It seems more intuitive than pressing search button, which is on the left side and hard to reach (at least for me). |
OK, it's not a bug. The logic is:
You can set The problem is: should I explain "you can" in this way? "you" + "can" or "you can", which is desired? |
@uchuhimo this is simple example. The problem is with search in search.xml at sites with big data (example you get by e-mail). For example, if we want to search by multiwords "you can give it from code" and we have many many other articles with words in start with "you" or "you can" — this articles will be shown firstly, and, probally, needed article with "you can give it from code" not be shown. Another words: i want to find "we wait for car" ("мы ждём машину"), and i have many many results by words "we" ("мы"), but needed article with this multiwords not exists in list. This multiwords wasn't find what u want. The problem with search multiwords is: need see at top in list that article, which absolutely contain this multiwords. |
@uchuhimo > OK, it's not a bug. |
@uchuhimo u understand what i mean? Give me answer, please. |
@ivan-nginx I get what you mean. To solve this problem completely, I have to search every combination of keywords, and then sort them by their match rate. By splitting N keywords and search each of them, I scan all the articles by N passes; By combining N keywords and search each of the combinations, I scan all the articles by 2^N passes, which is apparently unacceptable, especially when the number of articles is huge. There are several solutions/workarounds:
I think the third proposal is most suitable. How about you? Any better suggestion? |
@uchuhimo i'm for 3rd variant, of course. Need to show firstly by 100% contains multiwords, and others.. others results may be shown after main search keys. Search is search — if i search by "1 2 3 4 5" — search must me give article, what include "1 2 3 4 5" firstly with 100% contain, isn't it?
This is no matter. If i search by template of words and get that's what i searched — this is already victory for search. Other "we" or "we wait" no matter, if i get my searched article firstly by searched keywords. P.S. I talk for now from user-side only. ;) |
@ivan-nginx OK, I will add two improvements in the next pull request:
Any supplement? |
Yes, it's will be nice. I'm talking about it.
And i may add to this option button. Will be button or Enter. Yep. |
@ivan-nginx I submit a new pull request for these 2 improvements, check it please. |
Improvements:
Let search input get focus automatically when search panel pops up
Clean search input and search result when search panel closes
When search panel pops up, click anywhere outside search panel can close it
Sort result by hit count in article. Demo:
before:
after:
Padding search icon and button. Comparison:
before:
after:
Support to highlight keywords in title. Demo:
[fix] Let titles be shown with correct letter case instead of all lower case. Demo:
before:
after:
[fix] When you input several keywords, all the keywords' result will be shown. Demo:
before:
after:
Support to show first n highlighted results per article. Originally, search panel can only show first one result per article. Add a new configuration item
local_search.top_n_per_article
to config it. Default value oflocal_search.top_n_per_article
is 1 to keep compatibility. Demo:local_search.top_n_per_article
= 0:local_search.top_n_per_article
= 1 (default):local_search.top_n_per_article
= 3:local_search.top_n_per_article
= -1 (show all results):Note: I adjust the result concatenation algorithm to show specified number of results without overlapping highlighted word between adjacent results. It complicates the algorithm. If anyone has simpler solution, tell me ^_^