1

I am trying to set up a search that will only search a single field of a single content type. I am currently using search api with database search server module. I set up the search to index only this one field and a bundle filter that only returns results from the specified content type. The problem I am running into is the results.

If I set the field type to integer (it is a zip code I am searching through), it returns every search result regardless of if it contains the integer or not. If I set it to fulltext, it doesn't return anything regardless if i type an exact match to one of the fields it is indexing.

Am I setting this up right? Is there a better way to do this?

  • Better way to do this would be using Views and the built-in Filters. Exposing those filters will make it searchable. – Beebee Feb 6 '13 at 16:17
  • Can give a quick walk through? Not really sure what you mean. The user has to be able to input a number and the site will spit back the closest result. – BobbyDank Feb 6 '13 at 16:41
  • Install Views. Go to structure>views then Add new view. Show [content] of type [Your Content type here] (also tick Create a page) then Continue & edit button. Under FORMAT select Show: Fields. Then under FIELDS click Add button and add the fields you want to show in the result. Then click Add button next to FILTER CRITERIA and add your zip-code field. On the settings screen of that field tick "Expose this filter to visitors, to allow them to change it". Hope you can take it from there. – Beebee Feb 6 '13 at 16:51
  • You have got to be kidding me. That is SOOOOO much easier and it actually works. Thank you! – BobbyDank Feb 6 '13 at 17:00
  • You're welcome. Added as answer in case anyone else has same issue. – Beebee Feb 6 '13 at 17:03
1

You can do this with Views.

  1. Install Views.
  2. Go to Structure>Views then + Add new view.
  3. Set Show [content] of type [Your Content type here] (also tick Create a page) then Continue & edit button.
  4. Under FORMAT select Show: Fields. Then under FIELDS click Add button and add the fields you want to show in the result. Then click Add button next to FILTER CRITERIA and add your zip-code field. On the settings screen of that field tick "Expose this filter to visitors, to allow them to change it".

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.