Demonstration of CustomFieldsSearch

MT > CustomFieldsSearch

Field and the content

It is composed of the following fields.

name content tag type
Title Title of the book MTEntryTitle default
Description Description MTEntryBody default
ISBN ISBN booken_isbn text
Price Price booken_price text
Publisher Publisher booken_pub dropdown
Year Published year booken_year dropdown

Registered entries and example of search form

The following entries are registered.

About of search form

  • When the text is input to “Free word”, matching against the column that checked in the check box.
  • It is possible to narrow it by specifying “Publisher”.
  • It is possible to narrow it by specifying “Published year”. This part specified the condition with “OR search”.
  • “Free word”, “Publisher”, and “Publication year” become the “AND search”.

HTML Source of search form

<form method="get" action="<$mt:CGIPath$><$mt:SearchScript$>">
  <input type="hidden" name="CustomFieldsSearch" value="1" />
  <input type="hidden" name="CustomFieldsSearchClassType" value="entry" />
  <input type="hidden" name="CustomFieldsSearchIgnore" value="EntryTitle" />
  <input type="hidden" name="CustomFieldsSearchIgnore" value="EntryBody" />
  <input type="hidden" name="CustomFieldsSearchIgnore" value="EntryMore" />
  <input type="hidden" name="CustomFieldsSearchIgnore" value="EntryKeywords" />
  <input type="hidden" name="IncludeBlogs" value="<$mt:BlogID$>" />

  <fieldset id="freeword_set">
    <legend>Free word</legend>
    <input type="text" id="search_free" class="ti" name="search" value="<$mt:SearchString$>" /><br />
    <input type="checkbox" id="CustomFieldsSearchField_title" name="CustomFieldsSearchField" value="EntryTitle" /><label for="CustomFieldsSearchField_title">: Title</label>
    <input type="checkbox" id="CustomFieldsSearchField_text" name="CustomFieldsSearchField" value="EntryBody" /><label for="CustomFieldsSearchField_text">: Description</label>
    <input type="checkbox" id="CustomFieldsSearchField_booken_isbn" name="CustomFieldsSearchField" value="booken_isbn" /><label for="CustomFieldsSearchField_booken_isbn">: ISBN</label>
    <input type="checkbox" id="CustomFieldsSearchField_booken_price" name="CustomFieldsSearchField" value="booken_price" /><label for="CustomFieldsSearchField_booken_price">: Price</label>
  </fieldset>

  <fieldset>
    <legend>Publisher</legend>
    <select name="CustomFieldsSearchFieldLike">
      <option value="">-- any publishers --</option>
      <option value="booken_pub:O'Reilly">O'Reilly</option>
      <option value="booken_pub:Pragmatic Bookshelf">Pragmatic Bookshelf</option>
      <option value="booken_pub:Wiley">Wiley</option>
      <option value="booken_pub:Apress">Apress</option>
    </select>
  </fieldset>

  <fieldset>
    <legend>Year</legend>
    <input type="checkbox" id="CustomFieldsSearchFieldIn_booken_year_2006" name="CustomFieldsSearchFieldIn" value="booken_year:2006" /><label for="CustomFieldsSearchFieldIn_booken_year_2006">: 2006</label>
    <input type="checkbox" id="CustomFieldsSearchFieldIn_booken_year_2007" name="CustomFieldsSearchFieldIn" value="booken_year:2007" /><label for="CustomFieldsSearchFieldIn_booken_year_2007">: 2007</label>
    <input type="checkbox" id="CustomFieldsSearchFieldIn_booken_year_2008" name="CustomFieldsSearchFieldIn" value="booken_year:2008" /><label for="CustomFieldsSearchFieldIn_booken_year_2008">: 2008</label>
  </fieldset>

  <input type="hidden" name="limit" value="2" />
  <input type="submit" accesskey="4" value="Search" />

  <input type="hidden" name="CustomFieldsSearchLuckyArchiveType" value="Individual" />
  <input type="submit" name="CustomFieldsSearchLucky" accesskey="5" value="I'm Feeling Lucky" />
</form>

Example of using MTIfCustomFieldsSearchField in search result page

<mt:IfCustomFieldsSearchField tag="booken_isbn">
<!-- When ISBN is only a search key, it is displayed. -->
ISBN: <MTbooken_isbn>
</mt:IfCustomFieldsSearchField>

<mt:IfCustomFieldsSearchField tag="booken_price">
<!-- When Price is only a search key, it is displayed. -->
Price: <MTbooken_price>
</mt:IfCustomFieldsSearchField>

One Response to “Demonstration of CustomFieldsSearch”

  1. fnord12 Says:

    Hello, I know it has been a few years since you created this, but in case you are still answering questions…

    Is it possible to do an OR search for the same field. For example, in your scenario above, could I search for “Ruby” OR “Apple” in the Title field?

    I have been trying to set your plugin up and am having some trouble with that. Besides that, it has been a valuable tool, so thank you for creating it.

Leave a Reply