All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Search Query showing all pages

Peter Riley Osborne 1 Jul 2012 22:04 question, complete

Whenever i try and use my search query, it just prints all the pages in my site. I have created three different collections:

State, Month and Course

Below is the code for all three:

code> 
{exp:low_search:form collection="location" search_mode="exact"}
<!-- /.search -->
{/exp:low_search:form}
{exp:low_search:form collection="date" search_mode="exact"}
<!-- /.search -->
{/exp:low_search:form}
{exp:low_search:form collection="course" search_mode="exact"}
<!-- /.search -->
{/exp:low_search:form}


And my search results are just using your sample search results:

 
{exp:low_search:results query="{segment_3}"" limit="10"}
{if count == 1}<ul>{/if}
<li><a href="{url_title_path='courses/course_detail'}">{title}</a></li>
{if count == total_results}</ul>{/if}
{if no_results}No search results{/if}
{/exp:low_search:results}


Since I have all three set to exact, it should just give you the results that contain those options.

Thanks for any help!

Replies

  1. Low 2 Jul 2012 08:15

    First of all, I see your query parameter in the low_search:results tag has a " too much: query="{segment_3}"" should be query="{segment_3}"

    Secondly, make sure {segment_3} indeed is the encoded search query found in the URI.

    Could you also post the template code in a http://pastie.org ? GetSatisfaction messes things up a bit.

  2. Peter Riley Osborne 2 Jul 2012 15:56

    Thanks for getting back to me! I tweaked it a bit and was able to get the courses search to work, but the other two don't.

    I changed the name of the drop down to keywords, which fixed the third one (the course search field) but the other two still show no results.

    The other two are also searching in Matrix fields, which might be the issue.

    Here is my results page from pastie:
    http://pastie.org/4187960

    Here is the search page:
    http://pastie.org/4187979

    Thanks!

  3. Low 2 Jul 2012 16:04

    If you're searching Matrix fields, make sure the Matrix columns are searchable too, in the field's settings. You might need to re-save entries if the columns weren't searchable, as Matrix needs to populate the search field...

  4. Peter Riley Osborne 2 Jul 2012 17:01

    Ok, i updated my Matrix fields and I still get no results. For the state, I wonder if the date being a PT Dropdown in the matrix field is causing an issue?

    Also, this is my first time using the Low Search, so I was wondering if it was normal to always have the searches showing they need to be re-indexed when I view them? Maybe there is something with my installation?

    Finally, just to throw all the things out there that it could be, the expression engine files reside above the root of the site. Not sure why that would be an issue, but just in case... :) Thanks for all your help!

  5. Peter Riley Osborne 3 Jul 2012 03:14

    Hey, I was just following up to see if you needed any other information. Thanks so much for all your help!

  6. Peter Riley Osborne 3 Jul 2012 04:03

    Ok, so I may have found the issue. Can Low Search search by a matrix field that is a date object or a PT Dropdown? I created a field in my matrix form that was just month and set it as a text field. When I populated that with June and searched for it, I could find it. So I think the issue is that the dates are from date fields and the state is from a drop down and not a text field. Is there any workaround for this?

    Thanks man -

  7. Low 3 Jul 2012 07:17

    Low Search will populate the index it searches with data that's in the DB. In the case of a date field, this will be a timestamp (a big number), not the word 'January' for example.

    The workaround would be to create an additional drop down field with the month names as strings so they can be indexed.

    If the date field is not in a Matrix field, you could also try and use a keyword-less search and ranges to get to the right dates.

  8. Peter Riley Osborne 3 Jul 2012 15:38

    Ok, that worked great for the date. Now I have a state drop down that is two letters in the matrix field (for like CA vs. California). This same solution doesn't seem to work for that. Is there a minimum number of letters you can search for? Thanks

  9. Low 3 Jul 2012 16:16

    There is no minimum number of letters. However, if you're filtering by state like that, you might consider using the search:my_state_field option instead. Or is the state drop down in a Matrix field as well?

  10. Peter Riley Osborne 3 Jul 2012 16:26

    Yeah, it is in a Matrix field as well. Basically there is a matrix field that has a location and the dates that the event will be at that location. I want to be able to search by the state, month and event title. So far event title and month work great, but state is giving me no results.

  11. Low 3 Jul 2012 16:29

    So, the State column in Matrix is searchable, too? What fieldtype are you using for that? And what does your search form look like for that? Is that still the same as in the pasty above?

  12. Peter Riley Osborne 3 Jul 2012 16:35

    Thanks for getting back to me. Below is the search form just to be current:

    http://pastie.org/4193900

    And the field type is a PT Dropdown, but I also used just a text field and I also tried creating a brand new text field, just in case there was some issue with the old one. None of those worked.

    The PT Dropdown has Searchable checked and is also Required. It's tag is {state} but I also tried using something else {loc_state} just in case the term state was the issue.

    Thanks again for all your help. You have been a rock star!

  13. Low 3 Jul 2012 18:17

    The issue of not being able to find the states was caused by a combination of the way the index is built and the fallback search method (for small words and stop words). I managed to fix it by slightly altering the algorithm that generates the index and then rebuilding them.

    The fix will be added to the next version of Low Search.