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

Pages search is performed only by folder name #3316

Closed
Karmalakas opened this issue Apr 16, 2021 · 22 comments
Closed

Pages search is performed only by folder name #3316

Karmalakas opened this issue Apr 16, 2021 · 22 comments
Assignees

Comments

@Karmalakas
Copy link
Contributor

Am I assuming correctly, that pages search in Admin should be on these four fields?

I've tried it seems everything (even editing the system ... pages.yaml and completely emptying cache directory and then saving a page), but it searches only by name (it's folder I guess). Wanted to help here on Discourse, but it seems there's a bug.

Other custom flex-objects I have work perfectly fine with fields defined in this config path.

Did some debugging and here's what I found:

  1. Children pages return null properties
    $property here is title, but $this PageObject does not contain it and returns null and therefore page does not match the search phrase tipo
    image

  2. Even though I definitely have such page. This Tipo page is a typography folder page
    image

  3. Here's a full view when PageObject::getNestedProperty() returns null
    image

    1. ArrayProperty doesn't check in header
      image
    2. And ObjectProperty checks defined properties, which doesn't look like a place to be searched
      image

Beyond that point I can only guess how it's supposed to be, hence the issue :)

@Karmalakas Karmalakas changed the title Page search is performed only by folder name Pages search is performed only by folder name Apr 16, 2021
@Karmalakas Karmalakas reopened this Apr 17, 2021
@mahagr mahagr self-assigned this May 27, 2021
@mahagr mahagr added the bug label May 27, 2021
@mahagr mahagr added the fixed label May 27, 2021
@masetto
Copy link

masetto commented Jun 23, 2021

Hi @mahagr, are you sure that issue is fixed? Because if I search by title I have not expected results.

@mahagr
Copy link
Member

mahagr commented Jun 23, 2021

It works for me, just searched for a title.

@masetto
Copy link

masetto commented Jun 23, 2021

Are you sure that the title is different from folder name?

@Karmalakas
Copy link
Contributor Author

I completely forgot to test this. Will try probably after work

@mahagr
Copy link
Member

mahagr commented Jun 23, 2021

Yeah, they had no common letters in them.

@Karmalakas
Copy link
Contributor Author

Karmalakas commented Jun 23, 2021

For me now it searches by Page Title and Menu Title, but does not by folder name nor by slug. Is it supposed to be like this? What are key and name fields? My guess key would be a folder, but not sure. Still, according to default config, it should search these four fields - key, name, menu and title, shouldn't it?

@masetto
Copy link

masetto commented Jun 24, 2021

Hi, sorry, but for me it does not work and I don't understand why... This is my page frontmatter:

title: 'Senza titolo'
taxonomy:
    category:
        - Rinascita
    tag:
        - artwork
        - winner
        - biennale
template: artwork
firstname: Li
lastname: Yichen

The folder name is li-yichen. I'm using Grav v1.7.17 - Admin v1.10.17 on Linux.
In admin pages, if I search titolo I have no results.

@Karmalakas
Copy link
Contributor Author

By any chance you have a multi-language site and search in a wrong language, @masetto? Just guessing

@mahagr
Copy link
Member

mahagr commented Jun 24, 2021

I removed name (template has it's own filter) and added slug to search fields.

Can you try (see the commit) if it now behaves how you expect it to?

@Karmalakas
Copy link
Contributor Author

Karmalakas commented Jun 24, 2021

I removed name (template has it's own filter) and added slug to search fields.

Can you try (see the commit) if it now behaves how you expect it to?

Now it searches exceptionally only by folder. Neither Menu/Page title nor slug works.
Not sure what happened, but even after I restored to initial 4 fields it doesn't work anymore

@mahagr
Copy link
Member

mahagr commented Jul 1, 2021

@Karmalakas I cannot reproduce your issue. The search uses both title and slug, I tested that by using a different language.

@Karmalakas
Copy link
Contributor Author

I tried on two languages 😕 Will try again later on fresh install 🤔

@mahagr
Copy link
Member

mahagr commented Jul 1, 2021

So maybe this issue is multilanguage-related...

@mahagr
Copy link
Member

mahagr commented Jul 1, 2021

I can confirm that the issue is present with multilanguage, when you select another language than the default one.

@mahagr mahagr removed the fixed label Jul 1, 2021
@Karmalakas
Copy link
Contributor Author

I tried both default and not 🤔
I see you added the label Fixed, but is it really? Or there should be another issue created for multi-language pages search?

(I'll still try on fresh install)

@mahagr
Copy link
Member

mahagr commented Jul 1, 2021

No, I removed the fixed tag :)

Actually there were two issues:

  • the slug was not in the search field list
  • when using multi-language, search is performed before looking at the translated items

The first one has been fixed, but the second one has not.

@Karmalakas
Copy link
Contributor Author

No, I removed the fixed tag :)

My bad 🤦‍♂️


Thanks for the clarification :)

@masetto
Copy link

masetto commented Feb 28, 2022

Hi,
sorry, but the search still doesn't work for slug and title with multiple languages, not even for the default language.
For me this is a vital function because I have sites with hundreds of pages.

@phmg701
Copy link
Contributor

phmg701 commented Mar 19, 2022

Hello, I can confirm search is only performed by original folder name. No slug search, no tile search.
It would be great to have wider search options at least for the selected language.
Latest release Grav + Plugins as of today.
Thank you!

@mahagr
Copy link
Member

mahagr commented Mar 25, 2022

Should now be fixed. Search and filtering in general now matches the displayed items (or current language). The fix will be released early next week.

@phmg701
Copy link
Contributor

phmg701 commented Mar 28, 2022

Confirmed working by searching both slug or title in 2nd language and not returning result for the main language (English) as expected. Fresh local 1.7.31 install just updated to 1.7.32. Thanks!

@Karmalakas
Copy link
Contributor Author

Finally got to it 🙂 Sorry for the delay and keeping issue open.
Just tested and it seems to be working as expected. Thank you 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants