Jump to content

adding fields to the page search module


peterb
 Share

Recommended Posts

What are the field types you are trying to add to the search? The text search in the admin can only search fields that are indexed for fulltext searches. This includes text, textarea, cache and I believe a couple others. But of course all data in ProcessWire is searchable, but that search box in the admin is designed purely for partial-match text searches. It would be fairly simple to modify or extend the admin page search process if you are interested, I can guide you through it.

Link to comment
Share on other sites

thanks,

I know see that it is a "file" field that it is objecting to. I see all the text fields work. How do I index a "file" fieldtype for search?  I also would like to specify a custom field for the page list sort settings -> sort field. Is that extendable?

by the way, I am blown away how nicely pw is running with 5,000 pages.. I am in awe...

Link to comment
Share on other sites

I know see that it is a "file" field that it is objecting to. I see all the text fields work. How do I index a "file" fieldtype for search?

I was going to say to type "title body filefield.description" into the search fields in Modules > Process > Page Search. But went and tried it myself and see we're using a multi selection field rather than a text input. :) So I went ahead and changed it to a text input so that you can use subfields (like filefield.description) for searches. If you grab the latest commit, you should be able to configure the Page Search module to use filefield.description for admin searches.

https://github.com/ryancramerdesign/ProcessWire/commit/1cc0c0549d1f55fb380211037dc267be10b0b71a

For your own searches, you can already do this just by including filefield.description in your selector. For example, this would look for a match in either title, body or filefield.description:

$matches = $pages->find("title|body|filefield.description*=something"); 

If you start getting a whole lot of fields in your selector, you might get better performance out of bundling all the fields you want to search into a FieldtypeCache, and then searching the single cache field rather than the other individual fields.

I also would like to specify a custom field for the page list sort settings -> sort field. Is that extendable?

You can already do this. ProcessWire will let you select a field for automatic sorting as long as it has the "autojoin" option set in the field's configuration. So if the field you want to sort by isn't showing up in Children > Sort Field, then chances are that it's not set for "autojoin" in the field config. Go ahead and check that autojoin box and let me know if that solves it?

Thanks!

Ryan

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...