8 January 2010 at 7:01am
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!
16 April 2010 at 4:33am
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.