Project:Live Search
Version:5.x-1.0
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I added a div id to my page.tpl.php file to display the search results. If a very generic term is searched for, and paging is at the bottom of the div, once the "Next" or specific page number is selected, the next page bombs and is horribly ugly. I can't find another site using this module with more than a page of content to test paging. Please let me know if this is a misconfiguration of a real bug, thanks!

url you can see it in action is: GenericGeek.com, thanks!

Comments

#1

This is a real bug. I need to add paging functionality. This might take a week or so, and we'll need to test it after paging is implemented.

Another issue you brought up is on customizing where the search result goes to. Currently, adding another <div id="live-search-results" /> is more of a hack. I'll need to allow people to assign the target element that will be injected with search results.

Please keep a tab on this issue.

#2

Thanks for the quick response! I appreciate your help.

By the way, I love this module! Let me know when you have something and I'll test it.

Thanks again!

#3

Status:active» postponed (maintainer needs more info)

I've just committed the new code that should fix paging. The nightly development snapshot should be packaged with the new code sooner or later. The Last Updated field should be a date later than May 5, 2007. If it's May 1, 2007, then it's not updated yet.

If you don't want to wait, you can also check out the livesearch.js file directly and use it to replace your copy of livesearch.js.

Please note...
1. If paging works or not.
2. If the scrolling behavior is desired. Because your search result is lengthy, I thought that scrolling back to the top of the search result would be a plus on usability (the user wouldn't have to scroll back up to view the next page). Please give some input on this. More specifically: should this behavior be on by default? I'll definitely make this a configurable option, but for an average site maintainer, should this be on by default? My site, kourge.net, for example, will actually scroll down because of this.

I would also like to implement an option where you can configure where to inject the search results to. Currently the module blindly appends <div id="live-search-results" /> after the search field and injects the results into it. I want people to be able to choose between this default approach or an element of their choice. The element would be identified by its id attribute.

The reason I would like to do this is because although your hack works, it is technically wrong to have two elements with the same id to exist on a page. IDs are supposed to be unique. I'm actually surprised that this hack works.

#4

I grabbed that latest version HEAD and replaced all the files. Still no dice. When I do a very generic search like "Geek", I get 9+ pages of results. What is weird is that when hovering over the "Page 2" link, the url is actually "http://www.genericgeek.com/en/livesearch/node/geek?page=1" I tried changing the page= to another number, but still the same issue.

I also thought that the issue might be caused by having multiple <div id="live-search-results"></div> entries on the page. One being injected directly under the Search box, and the other that I hard coded in my page.tpl.php file, but when I removed the hard-coded one, and had the search results go directly under the search box, the same issue occurs.

I am not very familiar with the functions inside the Search module, but if you could determine how many search results are returned for a given search, instead of linking to the next page of results using a href=\"/en/livesearch/node/geek?page=2\" class=\"pager-next active\" title=\"Go to page 3\" you might be able to code the page buttons to parse through the returned results of the initial query and inject the next set of results inside the div.

For grins, I tried removing the live-search-results div in the page.tpl.php file and added it to the node.tpl.php file because of the paging url having "node" in the path, but that didn't work either. Isn't this fun?!? :)

#5

The paging mechanism is provided by Drupal's internal guts. And yeah, the paging numbers in the URLs are funny because they shift a value, but that's normal. I've tried to fix the code (again) and I'm sure this'll work. (I wonder if I'm putting my foot in my mouth by saying this.) Anyhow, the new livesearch.js can be checked out directly. The HEAD snapshot should follow the lead soon. Having a date of May 7, 2007 means it's updated. If it's not, you can check the file out directly and use it to replace your copy. Or you can wait for the new HEAD snapshot if that feels more secure. ;)

1. The scrolling behavior is not made a configurable option yet, but will soon be.
2. Should the scrolling behavior be on by default?
3. I'll also start coding the custom region injection feature. Can you help and test this too when it's available?

A few interesting notes on the mechanisms: the gibberish you saw was actually raw data of the search result that was passed back from the server. All I had to do was to grab the target URL of the paging link when it's clicked, fetch the URL with Ajax, and spit it back to the search results region. What I had problem with was how links were grabbed. Now there should be no link-grabbing problems.

#6

Checked out version 1.11 of livesearch.js and paging is now working as expected! Thanks! (No foot in mouth needed) :)

2. Scrolling behavior. I would opt for on. If the page popped right down to the paging links, you might scroll past the top search results, which might confuse users.

As a side not on scrolling behavior, you may want to see about adding the ScrollTo effect (from the script.aculo.us effects) to jump to the top of the results. It may be more user friendly than just having it "pop" abruptly to the top. I'm not sure if there is a similar effect in the jquery.js library. I have script.aculo.us installed on my server, so I could simply change that part to fit my specific needs, but might be worth looking into. I'll try to add this effect tonight on my installation and you can check it out and see if you like the way it works.

3. Custom region. Would be happy to test for you! Would rather have that as an option in the module settings instead of hacking the Template files.

Thanks again for looking at this over the weekend!

#7

I've just committed the new code. The HEAD snapshot should say May 8, 2007 when the package is updated.

Scrolling should now be a default behavior that can be optionally turned off. (I've tested this.) As for animated scrolling, I would love to do that, but the only thing is, jQuery doesn't provide such a mechanism. If you'd like to use script.aculo.us, replace line 58 in livesearch.js:
if (settings.scrollToResults) {scrollTo(target.get(0));}
with this:
if (settings.scrollToResults) {new Effect.ScrollTo(target.get(0));}
If you're familiar with Prototype, you'll notice that I stole the scrollTo function right from Prototype's Position.cumulativeOffset() and Element.scrollTo().

In the settings page, if you set the search results location to "Use specified custom element" and specify an element id in the textfield, Live Search will not insert a new <div> like previously mentioned. Instead, it'll use the element you specified.

In your scenario, since you already have the custom markup in your template, you simply need to choose "Use specified custom element" and specify the same id "live-search-results" as the custom element id.

#8

Re-uploaded latest version from the HEAD, and tagged line 58 with the scriptaculous new effect code..

Check out my site to see it in action. Demo Here

Also, did you change or will you allow the configuration of how much teaser text to be displayed? I don't know if this is controlled by the Live Search or the Search module, it just seems that there is less teaser text than before. I might have to go back into the options and see if I have missed a configurable option...

I noticed that the Admin page (by module) does not include a block (or section) for Live Search. Maybe this could be added in the future. Thanks again for the great help in getting this working for me.

I need to confirm another issue with logging, but I will submit another bug report if it's confirmed.

#9

Wow, the scriptaculous effect does look nice! ;)

I didn't change the teaser text, though. The Search module controls the teaser text. More specifically, the search_excerpt() function does the job. However, Live Search does offer options for hiding the metadata for nodes. I do that on kourge.net because I think they're somewhat extraneous.

When you mean a block for Live Search, do you mean a live search form? Live Search doesn't have its own block because the Search module already has one. In fact, if you were using the Search module's block instead of the theme's search box, all you have to do is to set the target search box to "block" instead of "theme. What I had in mind was to avoid reinventing the wheel and provide YAB (Yet Another Block).

From my own testing, the watchdog logging has been fixed. It should log events in the exact same style and manner as the search module does, such as the type and the message format, except for the accessed URL which is livesearch/node/keyword instead of search/node/keyword.

#10

Status:postponed (maintainer needs more info)» fixed

#11

Status:fixed» closed (fixed)

#12

Priority:normal» critical
Status:closed (fixed)» postponed (maintainer needs more info)

Hi,

I placed livesearch.js of version 1.11 given above in the livesearch module which was downloaded from http://drupal.org/node/95024 and still Im not getting pager working,how Can I get the totally UPDATED LIVESEARCH MODULE???

THanks in Advance......!

#13

Hi,

I have checked the site above given www.genericgeek.com , the pager still breaking in it.Can you plz help me to get rid of that pager problem in live search results page?

Thanks in Advance.......!

#14

Status:postponed (maintainer needs more info)» closed (fixed)

I checked genericgeek.com and it's working as expected. You probably downloaded a cached copy of the HEAD version or something. Clean your browser's cache and try to download again.