I am using PHP Codeigniter framework with solr-php-client to build a search application.
I have two pages -
The issue is, unless I enter a search term solr-php-client is not returning any results and for which the url would just be "http://localhost:8080/search/?q=" and it wont do anything. But when I enter a search term such as "apple" as an eg., it redirect to results page with matching results without any issue and the url becomes "http://localhost:8080/rdsearch/?q=apple"
What I would like to achieve is - When user does not enter a search term in the search page or when q is empty as in "http://localhost:8080/search/?q=", it should simply direct to results page and show all the results (similar to a solr query *:*)
There might be some other solutions available, I can propose you the following 2 solutions.
*:* as input with the Solr URL.
<str name="q.alt">*:*</str>
While querying
http://'localhost':8080/solr/collection1/select?q=&wt=xml&indent=true&defType=dismax
You can see though I've provided q= , but it'll return all the result. Because it'll take the q.alt query as the query parser is Dismax now. For further info please read here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With