0

I have built a website using Bootstrap v4.0.0-beta. I want to add the ability to search the site. I am attempting to use a script called Perlfect Search 3.37. Though it hasn't been updated in a while it has worked great on another site I have.

My problem is how to mesh the code for Bootstrap and Perlfect two together:

Bootstrap code:

<form class="form-inline my-2 my-lg-0">
  <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
  <button class="btn btn-outline-light submit2 my-2 my-sm-0" type="submit">Search</button>
</form>

Perlfect code [details on the parameters can be found on this site]:

<form method="get" action="/cgi-bin/perlfect/search/search.pl">
  <input type="hidden" name="p" value="1">
  <input type="hidden" name="lang" value="en">
  <input type="hidden" name="include" value="">
  <input type="hidden" name="exclude" value="">
  <input type="hidden" name="penalty" value="0">
  <select name="mode">
    <option value="all">Match ALL words</option>
    <option value="any">Match ANY word</option>
  </select>
  <input type="text" name="q"><input type="submit" value="Search">
</form>

I don't really care to use the "match" option.

I had tried the following but it doesn't return any results for any number of search terms that are available.

<form class="form-inline my-2 my-lg-0" method="get" action="/cgi-bin/perlfect/search/search.pl">
  <input type="hidden" name="p" value="1">
  <input type="hidden" name="lang" value="en">
  <input type="hidden" name="include" value="">
  <input type="hidden" name="exclude" value="">
  <input type="hidden" name="penalty" value="0">
  <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
  <button class="btn btn-outline-light submit2 my-2 my-sm-0" type="text" name="q" type="submit">Search</button>
</form>

Anyone have any ideas how to solve this?

  • What does the code you posted with the form for the search box have to do with the results returned? – Stephen Ostermiller Sep 25 '18 at 21:48
  • I'm not asking so much about the results as I am about combining the two codes so that it works as it should. – Lee Sep 26 '18 at 0:23
  • Do any of those work? It sounds like none of them do. If that is the case, it is likely a problem of how your search index is built. – Stephen Ostermiller Sep 26 '18 at 1:11
  • 1
    Have you tried adding <input type="hidden" name="mode" value="all">? – Stephen Ostermiller Sep 26 '18 at 18:39
  • 1
    It looks like you put the name="q" on the button rather than on the text input. – Stephen Ostermiller Sep 26 '18 at 18:40
1

In case someone else has the same type problem, here is the solution I used:

<form class="form-inline my-2 my-lg-0" method="get" action="/cgi-bin/perlfect/search/search.pl">
  <input type="hidden" name="p" value="1">
  <input type="hidden" name="lang" value="en">
  <input type="hidden" name="include" value="">
  <input type="hidden" name="exclude" value="">
  <input type="hidden" name="penalty" value="0">
  <input type="hidden" name="mode" value="all">
  <input class="form-control mr-sm-2" name="q" type="search" placeholder="Search" aria-label="Search">
  <button class="btn btn-outline-light submit2 my-2 my-sm-0" type="submit">Search</button>
</form>

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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