Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Multiple DataObject Search on Frontend [searchcontext]

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2036 Views
  • ciaranhickey
    Community Member
    17 Posts

    Multiple DataObject Search on Frontend [searchcontext] Link to this post


    I'm using a Custom Search Context for searching my DataObject (Author) from a single keyword input textfield on the frontend. I'd also like users to be able to search my "Books" dataobject, which has a one to many relationship with Author (ie. an Author has many Books associated with them), from the same keyword input textfield.

    My search works fine at the moment mapping the keyword textbox to the Author description but as I said I would like it to also search Book Descriptions for each author. Is this possible? I know I can achieve it by setting up a second search input textfield and map this to Books description but would like to limit user to one text box. I have tried Generic Views Module but have found the same limitation.

    I hope I am explaining this well enough. Any help would be great!

    Thanks in advance,

  • javelin
    Community Member
    12 Posts

    Re: Multiple DataObject Search on Frontend [searchcontext] Link to this post

    Now, I'm really new to Silverstripe but I'm currently working on a related problem. I guess it might be possible to actually run the search on both Author and Books by creating two contexts and also return two result variables from the searching function. (Or join the results somehow) I guess it also would reguire remapping the searchfield or something.
    Now, my own problem is figuring out how to only search the related "Books" (which you sort of hinted about). For example only search Books related to a certain Author when the user has previously defined the Author they are interested in.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.