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

Linkwiz update (#3498) #3499

Merged
merged 4 commits into from
May 12, 2022
Merged

Linkwiz update (#3498) #3499

merged 4 commits into from
May 12, 2022

Conversation

alexdraconian
Copy link
Contributor

This is pull request about issue #3498.

Linkwiz Searches title if useheading option is 1 or content
@alexdraconian alexdraconian reopened this Aug 14, 2021
@sokolgeo
Copy link

sokolgeo commented Nov 2, 2021

The solution in the above commit #4668fa1 looks strange:
// If search result is empty but 'useheading' option is 'always' or 'content',
// search page titles with original query.

I mean if 'useheading' option is 'always' or 'content' we must ALWAYS search first pagetitles and either not search by pagenames at all or amend the pagenames search results with the results from mandatory pagetitles search, no?

@alexdraconian
Copy link
Contributor Author

I was actually afraid to make big behavior change, since this was my early contribute. That's why I made this function as 'sub function' - Whan search fails, it will look for pagetitles.

So your suggestion is that ONLY search with pagetitles when 'useheading' is 'always' or 'content', right? I agree with this, and will make changes if this is right.

@sokolgeo
Copy link

sokolgeo commented Nov 4, 2021

Yes. To be explicit:

  1. We always search by pagenames, as it is already in place now.
  2. If 'useheading' is 'always' or 'content' then we additionally search by pageheadings and add these search results to the p.1 pagename search results
  3. We show the search results to user in the link wizard.

The only point I am not clear myself is: can we only search first heading on the page in p.2 above, when 'useheading' is 'always' or 'content'? If yes it would be perfect. If not, still the above logic would be great step forward compared to current reality, when headings are completely ignored by the link wizard at all!

Hope it clarifies

@alexdraconian
Copy link
Contributor Author

Okay, I've made changes to linkwiz always seaches with pagetitles, if 'useheading' option is 'always' or 'content'.

I decided to keep original search function with pagenames - Since there can be some pagetitles that contains special characters can't be entered with keyboard easily. (I meant ALWAYS instead of ONLY in above comment...)

@sokolgeo
Copy link

sokolgeo commented Nov 8, 2021

Thank you @alexdraconian
How to test the above patch in my docuwiki instance, please?
Just go and patch the inc/Ajax.php manually as per the above three commits?

@alexdraconian
Copy link
Contributor Author

@sokolgeo Right. If you encounter any bugs, please let me know.

@sokolgeo
Copy link

sokolgeo commented Nov 9, 2021

@alexdraconian

Does not work.

Now In the link wizard I can see the first headings of my wiki pages listed, as it was originally, but entering these heading into search box in the link wizard results in "Nothing was found.".

Anything else I can try to make this work? Any explicit ways to reset the browser cache or anything else?

@alexdraconian
Copy link
Contributor Author

Can you test if this works?
Change this line: if ($conf['useheading'] === '1' || $conf['useheading'] === 'content') { (3 equal signs)
to this: if ($conf['useheading'] == '1' || $conf['useheading'] == 'content') { (2 equal signs)

If you can, please open conf/local.php and check the value of $conf['useheading']. In my case, it was '1'. I wonder if your file says 1 (Without quotation mark)

Note: You don't have to rebulid index and discard browser cache. In my case, just patch ajax.php and this worked.
You can also press Ctrl + F5 to refresh and delete cache in browser for that site.

@sokolgeo
Copy link

sokolgeo commented Nov 9, 2021

Can you test if this works? Change this line: if ($conf['useheading'] === '1' || $conf['useheading'] === 'content') { (3 equal signs) to this: if ($conf['useheading'] == '1' || $conf['useheading'] == 'content') { (2 equal signs)

This made the trick! All seems to be working as it should now! Thank you @alexdraconian

If you can, please open conf/local.php and check the value of $conf['useheading']. In my case, it was '1'. I wonder if your file says 1 (Without quotation mark)

This was already correctly stored without quotation marks, thank you for the tip.

Note: You don't have to rebulid index and discard browser cache. In my case, just patch ajax.php and this worked. You can also press Ctrl + F5 to refresh and delete cache in browser for that site.

Thank you.

Can you please update the commit with 2 equal signs? How could it land in the main tree for the next official release?

@alexdraconian
Copy link
Contributor Author

I've updated and commit changed code.

Since I'm first-time contributor, maintainer must approve this pull request. I can't sure if this update become part of next release; I'm just contributor.

@sokolgeo
Copy link

Thank you for the patch @alexdraconian
Shall we maybe ask @splitbrain to review it for inclusion into the main branch?

@gerardnico
Copy link
Contributor

For your information, you can wrap you code in a action plugin that uses the search_query_pagelookup event if you don't want to wait for the approval.

@splitbrain splitbrain merged commit 10f6641 into dokuwiki:master May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants