Coder Social home page Coder Social logo

simplesearch's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

simplesearch's Issues

createExtract function returns wrong extract

I have searched for a word using also highlighting feature, but the extracted text does not contain the searched word.
I got into the source code, and I found out, thet $pos_start is computed wrong; most cases starts from zero which is wrong as the word is somewhere further in text.

Also, $extract is wrong;
this line from snippet $extract = array_pop($search->searchArray); clears the searched words and it can not highlight anymore the text; only first N resources are highlighted, where N is the number of words to search, and each word is highlighed in only one resurce content.
This final bug is introduced recently; it was not in previous versions.

Pagination links not populated properly

Hi,

SimpleSearch has bug in getPagination method (simplesearch.class.php).
Used in MODX Revolution 2.1.3-pl (traditional).

[[+link]] placeholder is not populated with proper values (actually it's not populated at all) causing results pagination to show broken links.

To fix the issue go to:
/core/components/simplesearch/model/simplesearch/simplesearch.class.php

and replace line 228:

$pageArray['link'] = $this->modx->makeUrl($id, $urlScheme,$parameters);

with:

$pageArray['link'] = $this->modx->makeUrl($id, '', $parameters, $urlScheme);

This should fix your pagination in search results

'q' doesn't work as searchIndex Property

Following snippet call redirects to the site start page rather than the landing page.

[code]
[[SimpleSearchForm? &landing=x &searchIndex=q]]
[/code]

Have learned this is a result of the FURL param being q. Perhaps it may be worth considering a less commonly used parameter as the default for the FURL functionality.

In any case, please mark this issue as closed :)

empty href atributes in result page links

In some browsers (FF 3.6, Opera), there are empty href attributes in result page links. It is OK in Chrome. This happens only for one of contexts.

Example case:

  • open page: http://www.malyprinc.sk
  • type 'seefeld' in search box up on page
  • the href attributes in result links are empty FF 3.6 or Opera but filled in Chrome

...this happens only for links target to only one of context (context_key and subdomain called 'lyzovanie' in this case)

searchresult.chung.tpl:
[a href="[[+link:is=``:then=[[~[[+id]]]]:else=`[[+link]]`]]" ...

  • modx version: MODX Revolution 2.1.3-pl
  • SimpleSearch 1.5.2

Please escape double-quotes

double-quotes needs to be escaped ( '"' => '"' ), or the SimpleSearchForm will start to harm by javascript infection.

Search by ids not working

[[!SimpleSearchForm? &tpl=mysearchform &landing=64 &useAllWords=1 &searchStyle=match &ids=6 &idType=parents]]

This returns results from all resources, not just resource 6 and it's children.

I have also tried

[[!SimpleSearchForm? &tpl=mysearchform &landing=64 &useAllWords=1 &searchStyle=match &ids=6]]

This has the same result.

Unauthorized resources contribute to results count

If resources exist to which a user does not have access, and those resources contain a keyword that is searched for, only the accessible resource extracts will not show up in the search results, however all the resources will contribute to the number of matching resources.

Example: say a site contains two resources titled "accessible" and "inaccessible" containing the word "hello", the former can be viewed by anonymous users and the latter cannot.
If an anonymous user searches for "hello", SimpleSearch will report 2 matching results, but display only the "accessible" resource in its results list.

default options and id's

'searchIndex' => 'search',

template provided has this defualt entry as an ID for a text input.
Suggest defualt changed to SimpleSearch or similar less generic default value

It would be helpful to people if they didn't have a default module option given an ID with such a common name, as it may cause people issues with styling thier pages as plenty of templates have their search form container with #search. as the ID,

Forward slashes not escaped in regex

There are a couple of places where the search term is not properly escaped, and forward slashes in the search terms conflict with the regular expression. It doesn't seem to affect the results, but it throws an "unknown modifier" PHP error in the logs, and the [[+text]] placeholder in the sisea.results_found lexicon is blank. Making sure the delimiter character (/) is escaped in the search string fixes the issue.

Line 122 in simplesearchdriver.class.php:

$qterm = preg_quote($term);

Should be:

$qterm = preg_quote($term, '/');

Line 342 in simplesearch.class.php:

$string = preg_replace('/' . $value . '/i', '<'.$tag.' class="'.$cls.' '.$cls.'-'.($key+1).'">$0</'.$tag.'>', $string);

Should be:

$qvalue = preg_quote($value, '/');
$string = preg_replace('/' . $qvalue . '/i', '<'.$tag.' class="'.$cls.' '.$cls.'-'.($key+1).'">$0</'.$tag.'>', $string);

Issue with fieldPotency and multi-page results

When there are multiple pages of results for a search query, the results do not seem to be weighted and sorted properly. The problem seems to be that the results are limited first, and THEN weighted according to the fieldPotency property. So for example, running a search query with perPage set to 10, it will limit the results, pull out the first 10 matches (unweighted, and sorted by whatever field is specified) and then weight+sort only the first 10 results. Likewise for the next page of results, and so on. So the results are not "truly" weighted - only the results for "x" page of results is sorted by weight.

One obvious solution is to pull out all matches (not limited), weight those results, and display the top x results.

useAllWords true and multilanguage

I created my first multilanguage MODx revo site with Babel and i'm having a problem with the parameter useAllWords.

If useAllWords is truethe context which is active will be ignored and the search is triggered in all contexts e.g. web and en (web = German; en = English).

Example:
I do a search for Home and on the result page the german and english version of Home will be displayed.

Numerical Highlight Class Name

The default highlight class name progression is:

.sisea-highlight 1
.sisea-highlight 2
etc.

I can't seem to get these progressions styled because the 2nd class name begins with a number. I see no problem with something like this:

.sisea-highlight .sisea-highlight-1
.sisea-highlight .sisea-highlight-2
etc.

Thanks!

Simplesearch to search different context instead of 1 context only

Hi, is there a way to improve the simplesearch function to search different context instead of just 1 context itself? Such as :
Web |-homepage
|- aboutus
- contact
anotherweb |- homepage
|- aboutus
- contact

So when the simplsearch is place in Web - homepage, the function will also be able to search the anotherweb -homepage, aboutus, contact.

Please advice. Thanks!

Few character search fault

When searching with only 2 characters (ie, an acronym of 2 characters, such as "fx"), search fails and result page shows an empty search string. When searching with 3 characters, results are inconsistent between search terms -
"(fx" will show an empty search string on results page but will show 1 correct result;
"(fx)" will show a correct search string and full results list;
"wat" wil show a correct search string on results pages and full results list.
What is minimum character limit? If search string is shorter than min character limit, can this be be shown on results page?

Use TV's as placeholders

I have 3 or 4 product websites I am developing at the moment in revo and have just realised I cant do a product search to display images, a product site without being able to search for the actual products isn't real user friendly. So if you could add this feature it would be much appreciated.

XHTML 1.0 Strict compliance

The default chunks fails the W3 strict compliance due to uppercase GET and a missing tag wrapper around the fields. I worked around by building a custom chunk with lowercase "get" and "fieldset" wrapper

Problem after last update... No result returned, no landing,...

Hello

I just updated SimpleSearch to beta 2, and now NOTHING work !
All the things that worked with previous release (i.e: returns the good number of results, and landing) don't work anymore.

To be sure I tried the simplest, with the 2 calls in my template without any parameter
CODE:
[[!SimpleSearchForm]]
[[!SimpleSearch]]

// I tried too
[[!SimpleSearchForm? ]]
[[!SimpleSearch? ]]

Always returns "no result found".

I tried with &landing parameter, redirection works but display "no result"...

Of course I cannot test if paging works as expected now...
Cheers

simple search pagination issues 1.4.0

when you type a single word, pagination works fine, if you type in two words to the searchform, the landing page shows the first set correctly but if you click on the second page, simple search compresses those two words together and says no results found try using a more general term, remember this was an issue quite some time ago, but was fixed before there was any answer with an update.

changing method in searchform from get to post, doesn't help either.
also my javascript comes back in the search extracts
still on revo 2.0.8 since just deployed site last night need to make sure on local host if the new revo release doesn't effect the site on localhost

cultureKey doesn't work with noResultsTpl in latest release

As stated in the title: I've set my cultureKey to NL now and all the other placeholders seem to be generating their Dutch counterparts, but the noResults placeholder keeps outputting an English message.

Also, could you please update docs with the &noResultsTpl parameter? I have no idea what its default content is.

SimpleSearch not sintalling from Package Management

When trying to install SimpleSearch in MODx Revolution 2.0.7-pl (traditional) I get the following error:

Console running...
Attempting to install package with signature: simplesearch-1.3.0-rc2
xPDOZip: Error opening archive at /home/designfr/public_html/qhp/core/packages/simplesearch-1.3.0-rc2.transport.zip
Could not install package with signature: simplesearch-1.3.0-rc2
Could not unpack package /home/designfr/public_html/qhp/core/packages/simplesearch-1.3.0-rc2.transport.zip to /home/designfr/public_html/qhp/core/packages/. SIG: simplesearch-1.3.0-rc2
Package found...now preparing to install.
PHP warning: ZipArchive::close() [ziparchive.close]: Invalid or unitialized Zip object
PHP warning: ZipArchive::extractTo() [ziparchive.extractto]: Invalid or unitialized Zip object

Term highlighting breaks if search includes the word "class" (but not as the first word)

This is an odd one.

I've found that (using SimpleSearch 1.3.0rc2) if I enter a search that includes the word "class", the search highlighting breaks and I get things like:

Search results:
6 Results found for "class="sisea-highlight sisea-highlight-1">puppyclass"

and

  1. Puppy Class
    You are invited to participate in a class="sisea-highlight sisea-highlight-1">Puppy Class for lots of fun, training and socialisation.

As I've elected to use the <strong> tag for the highlight, the results end up bolded as shown here.

This issue does not occur if the search is simply for the word "class" or if "class" is the first word in a multi-word search.

Sort Results by Date

It would be nice to have the ability to sort the results by date (last modified, date created, etc)

TVs as placeholders

Request to add TVs as placeholders in SimpleSearch.

SimpleSearch currently searches TVs but does not offer them as placeholders, meaning it is not possible to provide TV-based information in search results.

pagination issue, links return 404

I remember this being an issue a long time ago, I believe an update fixed the issue, but it's back, if I type a single word into the search, no problem, but if I type two words with a space it seems to return fine until I click onto another link in the pagination then it returns a 404
EDIT: modx revo 2.1.3 and Simplesearch 1.4.0
also looks &perPage is being ignored, I've googled like hell (after RTFM visit) but can't find a way to limit the pagination, like in getresources (or is it getpage?)

PHP warning: strpos(): Offset not contained in string

My error log has been filling up with these PHP warnings from SimpleSearch. It seems that it's possible for the offset passed to strpos() to be greater than the actual length of the extract, causing PHP to throw this warning. It doesn't affect the search results, but it can fill up the error log on busy sites.

Proposed fix:

Add this code above line 314 of simplesearch.class.php (at the start of the else{} condition):

                $pos_end = 0;

                if( strlen( $text ) >= $length - 1 ) {
                    $pos_end = min(strpos($text, ' ', $length - 1), strpos($text, '.', $length - 1));
                }

It simply checks to make sure that the offset is not greater than the length of the extract text.

1.4 Pagination Links are broken

The href attribute on the anchor tag is blank. It's as if [[+link]] is returning nothing in the default template.
sample output:
2 |

pagination problem with recent simple search 1.2.0. on revo 2.0.8

when using simple search, the search redirects to the landing page with results, but when clicking on a pagination link on the search landing page to more search results, no search results appear, just the text:

There were no search results. Please try using more general terms to get more results.

same across all my sites and clients sites which I have updated over the past day.

Pagination - search result #1 is on second page

Using Revolution 2.0.8 Traditional - SimpleSearch 1.3.0.

This occurs when perPage is set to the default of 10 results per page (or basically when pagination comes into play). When a search is more than 10 results it puts result number 1 as number 1 on page 2. The second result is then result 1 on page 1.

Thanks for the great extras and CMF!

Problem with paging

I call SimpleSearch in my results page with this call :
CODE:
[[!SimpleSearch? &perPage=5]]

I have ten results for my search request, so the "results pages" is 2, and is well displayed in the [[+paging]] placeholder, the problem is the first page displays all 10 results not only the first five. I expected to have the first five results on the first results page, the five next on the 2nd page, etc...
If I click on the second page, these one has its 5 results as expected...

Multiple search terms concatenated to one term in search box and results message

A search for "red cars" produces correct results with page URL: results.html?search=red+cars&x=27&y=10&id=15. Search box shows "redcars" and results message is "X results found for redcars". Pagination links are set to: results.html?search=redcars&sisea_offset=3 which when clicked give a "no results found" message because search term has changed to "redcars".

See http://modxcms.com/forums/index.php/topic,62169.0.html and http://modxcms.com/forums/index.php/topic,63242.0.html

Problem appears to have been introduced some time after v1.1.0. I updated a Rev 2.0.4 installation I had from a few months ago from v1.1.0 to 1.3.0 rc2. No problems with 1.1.0, but after update to 1.3.0 rc2 through package management, I now have the concatenation issue. Experiencing the same issue on Rev 2.0.5 and 2.0.7 sites.

Console log after 1.3.0 rc2 update:

Console running...
Attempting to install package with signature: simplesearch-1.3.0-rc2
Package found...now preparing to install.
Grabbing package workspace...
Workspace environment initiated, now installing package...
Attempting to preserve files at /my-site-path/core/components/simplesearch into archive /my-site-path/core/packages/simplesearch-1.3.0-rc2/modCategory/757ed0edb4a32eebabdb41ab93d73d38.0.preserved.zip
Successfully installed package simplesearch-1.3.0-rc2

Error log after update:

[2011-04-11 19:14:44] (ERROR @ /my-site-path/core/xpdo/compression/xpdozip.class.php : 142) PHP warning: ZipArchive::extractTo() [ziparchive.extractto]: File exists
[2011-04-11 19:14:44] (ERROR @ /connectors/workspace/packages.php) Could not unpack package /my-site-path/core/packages/simplesearch-1.3.0-rc2.transport.zip to /my-site-path/core/packages/. SIG: simplesearch-1.3.0-rc2

I have a site with a Manager account you can use if that helps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.