-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: questions with synonym tags do not show under the origin tag #685
Conversation
@hgaol Firstly, thank you very much for your contribution. In the page But in the page |
Thanks for figuring it out! I'll fix it later. |
update, after dive into the SQL logic, I guess the original design is option1. So for the synonym scenario, I think it may need a 2D array for tags. Each dimension is for each tag and its mainTag and synonym tags. Takes 2 tags as example, the logic could be
Hi @LinkinStars , one quick question, what's the expected logic when there're multiple tags? option 1 or 2? I think for synonym tags, it's option 2. what about if 2 different tags? option 1: return objects with both |
Currently, SQL supports multi tag search. If you need to support synonymous tag search, you should directly query synonymous tags when parsing the underlying tags. This way, future search plugins can also be used. The Search Parse Code : You can add code like |
Hi @kumfo , I've tested adding
but found it'll only return the objects with all these tags exist. You can find part of the SQL for search. IMO, it does not solve the issue. Take
|
Sorry! I know what the problem is, and I overlooked the previous search logic. The original tag search must include all these tags at the same time. If you want to modify it now, this search logic will probably need to be processed during the search query. You need to change the code in file However, if possible, you can parse the synonymous tags in |
Hi @kumfo , exactly! I've pushed new commit about the changed logic for easy communication. In a word, it changes the original SQL from AND tag_rel0.status = 1
AND tag_rel0.tag_id = tagId1
AND tag_rel1.status = 1
AND tag_rel1.tag_id = tagId2 to AND tag_rel0.status = ?
AND tag_rel0.tag_id IN (?, ?)
AND tag_rel1.status = ?
AND tag_rel1.tag_id IN (?) As you mentioned, it changes the interface and all the search plugin need to be modified to be compatible. I'm not sure if there's any better solution. Feel free to let me know and I can implement in this PR. Thanks! |
@hgaol Good Job! but I saw your commit that find you not change the query conditions to Original is :
it need to change like this:
you can search the code comments of |
Hi @kumfo , thanks for your review! I found that when there's array in but agree that your solution is more clear to indicate that it's a |
I haven't updated for |
Yeah, you need to update SearchQuestions and SearchAnswers as well. Because there are three ways to search, the default search includes questions and answers. If questions(use |
hi @kumfo , updated. Since |
There is no problem in handling it this way. I personally think that using the If you are willing to continue to make changes, I will wait for you to make changes and merge the code in. If you keep the current situation, it doesn't matter, I will also merge the code in.😊 |
Updated to replace with |
Hi @hgaol Well done!, I merged it to |
fix #680 .