Jump to content

parent subfield selector text search


Soma
 Share

Recommended Posts

When I have a selector with a parent.field all other fields get ignored:

title|body|parent.title%=keyword

Doesn't return result that would be found in title or body anymore. Is this a limitation for the parent field?

Link to comment
Share on other sites

I tried to reproduce that here, but it seems to be returning the expected result for me: 

$items = $pages->find("title|body|parent.title%=France"); 

Here's the results I got. The "title" matches the first item, and "parent.title" matches the rest of the items (which don't include "France" in any of their fields). They all have a blank 'body' field. 

/regions/europe/france/
/regions/europe/france/arles/
/regions/europe/france/avignon/
/regions/europe/france/beaune/
/regions/europe/france/blaye/
/regions/europe/france/bordeaux/
/regions/europe/france/cadillac/
/regions/europe/france/chalon/
/regions/europe/france/conflans/
/regions/europe/france/giverny/
/regions/europe/france/les-andelys/
/regions/europe/france/lyon/
/regions/europe/france/normandy-beaches/
/regions/europe/france/paris/
/regions/europe/france/pauillac/
/regions/europe/france/rouen/
/regions/europe/france/saint-emilion/
/regions/europe/france/strasbourg/
/regions/europe/france/tournon/
/regions/europe/france/vernon/
/regions/europe/france/vienne/
/regions/europe/france/viviers/
Link to comment
Share on other sites

Is that test with multilanguage fields?


I can't get it to work, even when I tried from a template.

The module I tried to get it to work is ImageManager, but I did remove the parent.title at the end since it's also not really needed.

Link to comment
Share on other sites

Is that test with multilanguage fields?

Yes, my title and body fields were multi-language. Though I only had the default (en) language populated. To duplicate the issue, would I populate the title in some other language, make that my $user language, and then perform the search? Just want to make sure I understand the all the factors necessary to reproduce. 

Link to comment
Share on other sites

I tested again in different installs a little after your post and it partly works, but when using parent.title in the fields

title|parent.title%=space

I get the space parent and all it's children ... but NOT other pages outside that parent that have space in it's title.

Hope that makes it clear. It's like AND and not OR.

Link to comment
Share on other sites

I'm wasn't seeing that behavior here the other day, as several other pages matched when I tested, but I only copied/pasted enough in here to communicate. I need to go back and test again when in a non-default language. Just to confirm, this is occurring in a non default language?

Link to comment
Share on other sites

Hey Ryan, I tested again on different installs and I'm still getting strange results.

$pages->find('title|parent.title%=space');

In my language enabled install I get something like the following, no matter what user language is set to. Although it should return other pages that also have "space" in their title, it doesn't return them in the result.

Title: Space | Parent: Images
Title: hubble-wallpaper-space | Parent: Space
Title: hubble-wallpaper-space-647500_1600_1200 | Parent: Space
Title: outer-space-stars | Parent: Space
Title: space-space-584336 | Parent: Space
Title: pastedgraphic-2 | Parent: Space
Title: pastedgraphic-3 | Parent: Space
Title: 492772525_d8803eb637_o | Parent: Space
Title: 2400862255_daeb5326d8 | Parent: Space
Title: pwprofile_ch-uploads-4 | Parent: Space
Title: pwprofile_ch-uploads2-4 | Parent: Space
Title: pwprofile_ch-uploads-4 | Parent: Space
Title: pwprofile_ch-uploads2-4 | Parent: Space
Title: pwprofile_ch-uploads-4 | Parent: Space
Title: pwprofile_ch-uploads2-4 | Parent: Space
...

 

Notice the first has parent "Images". Which is strange as there's also "space" in titles under "Nature" parent!
When I remove the parent.title from the selector I get this:

 

Title: Space | Parent: Images
Title: hubble-wallpaper-space | Parent: Space
Title: hubble-wallpaper-space-647500_1600_1200 | Parent: Space
Title: outer-space-stars | Parent: Space
Title: space-space-584336 | Parent: Space
Title: space | Parent: Nature
Title: space | Parent: Nature
Title: space | Parent: Nature

 

In my other install with different pages but same selector, where I don't have language support installed:

 

Title: Templates space | Parent: Home
Title: asdasd§ | Parent: Templates space
Title: sdf sfs f | Parent: Templates space
Title: gsgfdsf | Parent: Templates space
Title: fgfdsgsa as | Parent: Templates space
Title: Space | Parent: Images
Title: space-space | Parent: Space

 

 

It finds all that it should with "space" either in title or parent title.

Link to comment
Share on other sites

Soma, while I wasn't able to duplicate that here, I was able to find a bug when using just parent.title, so I'm wondering if it might also be responsible for the result you were getting. Can you try the latest dev branch and let me know if you are still experiencing the error?

  • Like 1
Link to comment
Share on other sites

Scary that you can't reproduce this...

Well, I just tested with latest version and now it seems to work as it should! :)

The result of the previous test first example is now like this:

Title: Space | Parent: Images
Title: hubble-wallpaper-space | Parent: Space
Title: hubble-wallpaper-space-647500_1600_1200 | Parent: Space
Title: outer-space-stars | Parent: Space
Title: space-space-584336 | Parent: Space
Title: 1920x1080-wallpapers-of-nature-1249994468-1 space | Parent: Nature
Title: nature_444_photos space | Parent: Nature
Title: serena space | Parent: Nature
Title: | Parent: Space
Title: | Parent: Space
Title: | Parent: Space
Title: | Parent: Space

...

So the pages with a "Nature" parent are showing now. So definately you fixed something that was causing this.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...