0

I'm working with the Google Search Appliance and corresponding drupal module. I've followed the user guide linked on the project page (also here) on creating filters. I was hoping to create a date range filter, however, I'm a bit stumped on how to filter on content types that have date ranges themselves.

For example, if I had a content type of person who had a year range of 1900 - 1970 (IE, years they lived). I figured I would create a metadata field that would have each date listed, so that google would know each year the content type covers. The filter part is the part where I'm having trouble.

In my custom module, i'm trying to set my $query['gsa_query_params']['requiredfields'] to be a range of dates in the form of "1900|1901|1902". That does work, but if the range is too big (around 30 years), the search fails. I'm lost.

  • You mentioned you created other filters? If you did, and you use the filters during your search, does that change the length of the range you can use before your search fails? – Jance Sep 5 '14 at 19:45
  • Yes, adding more filters will cause the date range length that I can use to shrink. – user35886 Sep 5 '14 at 19:47
0

So the drupal module uses curl to query the google search appliance, which means if your url is too long, you may run into issues.

It would be better to send a range to the Google search appliance by altering the $query['gsa_query_params'], ether by using the required-fields or partial-fields.

However, google doesn't currently support ranges to be sent via these options. Hopefully they'll add that functionality, but if you can't wait indefinitely for them to add the functionality, you can get a bit hacky and get it to work.

So, the Google Search Appliance has a flag, "inmeta" which does allow you to create a integer range. The catch here is it can only be used in a query field. IE a search for

"John Doe AND inmeta:1901-1940"

What you could do though is use the GSA Drupal module.

hook_google_appliance_query_alter (where your altering your queries to create your other filters) to add to your q string "AND inmeta:[range]". The issue here is that when you use this, drupal will display the full q string, with the inmeta field showing. Which might look strange for your users. You could save a copy of the q string before adding the range to your $query variable. Then, before displaying the page, but after the query has been executed, switch the query string back out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy