Skip to content
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

[RFC] Combine "Search from current article" and "Search whole wiki" #900

Closed
wants to merge 1 commit into from

Conversation

Mortal
Copy link
Contributor

@Mortal Mortal commented Aug 4, 2018

Currently, the search field at the top of every wiki article only searches articles below the currently viewed article. On my wiki it is rarely useful to search under the current; it would be preferable that the search page shows results from the entire wiki.

I'd suggest merging "Search from current article" and "Search whole wiki" so that the search results page displays first the results under the current article, and then displays results from the whole wiki.

I'll work on an implementation in this PR.

@codecov
Copy link

codecov bot commented Aug 4, 2018

Codecov Report

Merging #900 into master will decrease coverage by 0.03%.
The diff coverage is 70%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #900      +/-   ##
==========================================
- Coverage   74.28%   74.25%   -0.04%     
==========================================
  Files         106      106              
  Lines        4340     4358      +18     
==========================================
+ Hits         3224     3236      +12     
- Misses       1116     1122       +6
Impacted Files Coverage Δ
src/wiki/views/article.py 68.15% <70%> (-0.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd09cab...fce8d3b. Read the comment docs.

@benjaoming
Copy link
Member

That sounds interesting!

Btw you can merge querysets like this:

qs = models.SomeModel.objects.filter(...) | models.SomeModel.objects.filter(...)

This is the same as SELECT * FROM ... UNION SELECT * FROM ....

@benjaoming
Copy link
Member

And I think it would work great by for instance combining with unique() such that there would be two headers:

Results in '{{ article.title }}'

...

Results from remaining wiki

...

@benjaoming
Copy link
Member

Hey @Mortal og @neic - any updates on this? Would love to get it merged in, just worried about the situation with duplicate stuff. For instance if you search the "root" article and then you get confusing results from "root" and the whole wiki at once. So would be nice to combine two different querysets and somehow be able to remove duplicates from the "whole wiki" set such that it's actually "other results from the rest of the wiki".

@Mortal
Copy link
Contributor Author

Mortal commented Oct 23, 2018

I'm currently busy with work, so I haven't had the energy to work on this for a while. I'll pick it up again eventually - feel free to either close this or let it stay open.

Wrt. duplicate stuff, I could imagine only doing the combination if "search from current article" does not give a lot of results (say, more than 50) - in that case, we can just exclude the matched pages by id in the "whole wiki" queryset.

@benjaoming
Copy link
Member

I think it is a nice change, please feel encouraged to have time :)

Maybe we could make use of the already existing structure and just offer the user a link to jump back and forth between to different search types?

/_search/?q=test  # Searches full wiki
/slug-name/_search/?q=test  # Searches inside 'slug-name'

So, currently by default if you are viewing slug-name, then you will search in that hierarchy. This isn't desirable!

If we add the originating article as a querystring parameter, we could retain where the user was coming from?

/_search/?q=test&from=/slug-name  # Searches full wiki, providing a link to only search in 'slug-name'

In the case of displaying a link, we could perform a count on the search results. E.g. "View search results ONLY in Article Title (123 results)".

This is easy to implement, because it doesn't require considering the size of the result query sets or to have to combine them or merge them in the pagination :)

@benjaoming
Copy link
Member

Hi @Mortal - thanks for starting the work on this. I suppose you didn't have time to finish it. You're always welcome to re-open the PR or start a new one in case you want to continue this effort!

@benjaoming benjaoming closed this Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants